OmniFocus Actions Pack for Keyboard Maestro

[Updated to include 2 actions to get IDs and URLs of selected messages, also updated so that list items are separated with new lines instead of commas, so that it is easier to process list items in Keyboard Maestro.]

Hi Brett, sorry for the slow reply, I was on holiday, without a computer.

Here is the Mail Actions Pack, it is similar to the OmniFocus Actions Pack: you have to:

  • Uncompress and copy the MailLibrary.scpt in ~/Library/Script Libraries/
  • Uncompress and copy the Mail Actions Pack actions to ~/Library/Application Support/Keyboard Maestro/Keyboard Maestro Actions/

This pack provides five actions:

  • Mail Get IDs of Selected Messages
  • Mail Get URLs of Selected Messages
  • Mail Forward Message with ID
  • Mail Open Message with ID
  • Mail Reply To Message with ID (with Reply to All option)

I have included four macro examples in the OmniFocus Palette Mail Macros.kmlibrary Library.

You can get the unique ID of a message with AppleScript. Or you can use the provided Keyboard Maestro Action "Mail Get IDs of Selected Messages". To get the URL of the currently selected messages, simply use the Keyboard Maestro Action "Mail Get URLs of Selected Messages".

A bit of explanation:
The Mail message ID is extracted from a Mail message URL with the following format: message://%3cmessageID%3e for example message://%3cwT7bskxLPA@ismtpd0027%3e - the message://%3c and %3e tokens are used to find the message ID. This means that for these macros to work, your OmniFocus task should have a valid message://... URL in its notes (see screenshot below). It doesn't have to be the first line in the note.

Screenshot%202019-08-18%20at%2009h03m18s

See attached script "rule → omnifocus.sendto.scpt" as an example. This is the script that I use to send every unread Mail message to OmniFocus Inbox (I trigger it with Keyboard Maestro when OmniFocus comes to the front). It is unlikely to work as is, you'll probably need to adapt it to your specific environment. See screenshot below for the Keyboard Maestro script that I use to trigger it.

I hope this helps.

OmniFocus Palette Mail Macros.kmlibrary (78.0 KB)

MailLibrary.scpt.zip (478.2 KB)
Mail Actions Pack for Keyboard Maestro.zip (2.3 MB)

1 Like