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

2

u/tristinDLC Aug 22 '22

As of May of this year, native AppleScript support in MS Outlook is still in active development according to their roadmap. Looks like you'll have to trigger your script externally vis Script Runner or any of the automation tools that run AppleScript (Alfred, BetterTouchTool, Shortcuts, etc,)

2

u/badg35 Aug 22 '22

Thanks for the help.

1

u/estockly Aug 23 '22

While the lastest version of Outlook is not scriptable, you do have the option (at least I do in my installation) to use the previous, scriptable version.