David Sparks posted about a clever idea to instantly link to Apple Mail messages from anywhere:
I’ve always like the way OmniFocus can create links to Apple Mail messages when saving an email as a task…
I’ve now got a script that can do that anywhere via a text expander snippet…
Once you’ve installed it, just type “elink” in any app that can take a URL and you create a link to the currently selected email message. I use it all the time in Notes and Calendar note fields but it really works anywhere.
Here’s an adaptation that works with MailMate and Keyboard Maestro:
MailMate doesn’t have a ton of AppleScript support, but there is built-in
Copy Links to Messages bundle command, and you can execute bundle commands via AppleScript.1
So it was just a matter of stringing together
- A typed keystroke trigger (I’m using
elink, Spark’s shortcut of choice)
- MailMate’s copy command
For good measure, the final action restores the prior clipboard contents.
- This is why I used Keyboard Maestro instead of TextExpander: TextExpander needs scripts to return a specific value for typing, but the MailMate script is run indirectly, puts the url on the clipboard, and returns empty. With Keyboard Maestro, the next step (pasting the clipboard) is trivial. ↩