Simpler method of getting message-linked todos into OmniFocus 2

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!

6 thoughts on “Simpler method of getting message-linked todos into OmniFocus 2”

  1. Thanks for this – very helpful.

    I wanted more in the OmniFocus item note, so inserted two more actions after the “Type the ⌘V Keystroke”.

    (1) To set the clipboard to text with the mail subject, from, and contents

    (2) To do another Type the ⌘V Keystroke to paste it into the note.

    The screen capture below shows what I inserted.

    1. Thanks for that, too. I wasn’t aware that they had made a new one for v2. This is no mentioned in the OmniFocus v2 help.

      1. Yea, you shouldn’t need it with what you’ve created.

        The one nicety to your script is that you only have one command to trigger whether you’re in Mail, or somewhere else on the system. That distinction was lost during my initial read.

        :thumbsup:

Agree? Disagree? What do you think?

This site uses Akismet to reduce spam. Learn how your comment data is processed.