Looks like no one’s replied in a while. To start the conversation again, simply ask a new question.

OS High Sierra - Run Applescript On Open Email

In Apple mail you use to be able to run AppleScripts from a script menu on emails. This doesn't seem to be available anymore.


I have an AppleScript that gets the message ID. I need to run this on specific email messages. How can I deal with this now? I can see how to make an email rule that runs an AppleScript but this is not a global script that I want to run. I want to select a specific email and run a script on it.


I also use to be able to drag the message time stamp to the calendar and get the message ID but that doesn't seem to work anymore either.

MacBook Pro with Retina display, OS X El Capitan (10.11.5), 16 GB RAM

Posted on Dec 15, 2017 5:30 PM

Reply
4 replies

Dec 16, 2017 5:54 AM in response to munkymajik

I haven't had the AppleScript menu enabled for a while, so I'm not sure what is limiting it.

You could create an Automator Service that gets the email you have selected and runs the AppleScript.

Create a new Automator Service that receives no input in Mail.

Add a Run AppleScript Action from the Utilities menu.

Modify your script (if necessary) to get the selected message(s) and put it into the Action where indicated.

You can delete the "return input" line as the Action doesn't get anything to pass along ("input" argument will be empty).


Save the Service.

Open Keyboard System Preferences, Shortcuts tab.

Find Services in the category list on the left, then find your Service in the list on the right.

Add a shortcut to the Service (cmd-shift-I appears to be open in Mail).

Now, you can select the email message in the list, then type the shortcut to have it run the AppleScript on the selected message.

If the shortcut doesn't work initially, select the Service from the Services menu in the Mail menu. The shortcut should then work (long-standing bug with Services).

OS High Sierra - Run Applescript On Open Email

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple ID.