Simpler method of getting message-linked todos into OmniFocus 2 | Dafacto
Dafacto

The personal website of Matt Henderson.

Simpler method of getting message-linked todos into OmniFocus 2

27 May 2014

A couple of days ago, I posted an article detailing how to use Keyboard Maestro to create todos in OmniFocus 2 that are linked to original messages in Mail.app. Security-conscious Ben Brooks thought the idea was neat, but couldn’t give it a try, as it relies on the use of the OmniSync Server.

That got me thinking, and I came up with a simpler way to achieve the same thing—directly, without having to generate and send messages to the OmniSync Server Mail Drop.Here’s the idea:

  1. Assign [control][space] to the Keyboard Maestro macro. This is the keystroke I normally would have assigned to OmniFocus's Quick Entry feature.
  2. Assign some other keystroke to OmniFocus's Quick Entry feature.

And here’s how the Keyboard Maestro macro works:

  1. Check if we're in the Mail.app application. If not, invoke the OmniFocus Quick Entry trigger keystroke.
  2. If we are in Mail, then get the URL of the selected message.
  3. Invoke the OmniFocus Quick Entry trigger keystroke, paste the message URL into the Note field, and return cursor focus to the title field.

This works great! Here’s what that macro looks like:

And repeated from the previous post, here’s the AppleScript that gets the selected message URL:

tell application "Mail"
    set _sel to get selection
    set _links to {}
    repeat with _msg in _sel
        set _messageURL to "message://%3c" & _msg's message id & "%3e"
        set end of _links to _messageURL
    end repeat
    set AppleScript's text item delimiters to return
    set the clipboard to (_links as string)
end tell

Enjoy!

Enjoy this article? — You can find similar content via the category and tag links below.

Questions or comments? — Feel free to email me using the contact form below, or reach out on Twitter.