In the last post we demonstrated how to automate a task using AppleScript and the Fake scriptable web browser. Often, I use automator included on every Mac to perform such task. To activate them, we bind them to a keyboard shortcut in the given application. The example we will use today is to press the a keyboard shortcut to load the remote content of an email in Mail.app (you have of course turned off loading all remote content in emails by unselecting Load remote content in messages in the Viewing part of Mail.app Preferences).
Create the automator workflow
We start by creating the automator workflow:
- Start Automator and select New Document.
- Choose the type of workflow to be Services.
- Choose that service receives no input in Mail.app.
- Open Mail.app and open an email with (unloaded) remote content.
- In Automator, press the Record button.
- In Mail.app, press the Load Remote Content button.
- In Automator, terminate recording.
- Save the service workflow with the name Load Remote Content.
You should now be able to run this from the Automator to test it (try it by selecting a message with remote content, where the remote content is not loaded). Before you test it be sure that you have given Automator (and Mail.app) access to control your computer. You do that in System Preferences (Security & Privacy → Privacy → Accessibility).
The keyboard shortcut
You should check that the Service you have created is visible in the Mail → Services menu (the Load Remote Content menu is there). If it is there, let us create the keyboard shortcut for it. Open System Preferences and select Keyboard → Shortcut. In App Shortcut add a new with the plus (+) button. Choose Mail.app for the Application, and in the menu title type exactly as it was written above: Load Remote Content. Choose your Keyboard Shortcut (I used Shift-Control-Cmd-I) and press Add.
Now, whenever you read as message with (unloaded) remote content, pressing the keyboard shortcut will load the content in the message.