r/applescript • • Aug 22 '22

Call an AppleScript from MS Outlook

I created an AppleScript to empty the junk and trash folders:

tell application "Microsoft Outlook"
	
	set theJunkMailFolder to junk mail
	set theMessages to every message in theJunkMailFolder
	
	repeat with theMessage in theMessages
		permanently delete theMessage
	end repeat
	
	set DeletedItemsFolder to deleted items
	set theMessages to every message in DeletedItemsFolder
	
	repeat with theMessage in theMessages
		permanently delete theMessage
	end repeat
	
end tell

I'd like to be able to call it directly from Outlook. Can this be done or will I need to do so from the AppleScript menu bar?

4 Upvotes

6 comments sorted by

View all comments

1

u/schlumpi Sep 23 '22

I understand why you want to call the AppleScript from Outlook, but maybe I have a solution for your problem.

Probably it makes sense for you to trigger the AppleScript by Cron or launchd to specific times?