Send Flagged Mail Messages To OmniFocus Automatically

Send Flagged Mail Messages To OmniFocus Automatically

Sven Fechner pointed today to an AppleScript published in late 2011 by Hunter Hillegas to send flagged Mail.app messages to OmniFocus’ inbox on the Mac.

In iOS 5, Apple added the ability to flag a message, just as you’ve been able to do on the desktop forever. I created an AppleScript that looks for flagged messages. When it finds them, it adds them to OmniFocus and links them back to Mail.app, just like the Services action does. It then also unflags the message, resetting the state back to normal. This script runs every five minutes.

In iOS 6’s Mail.app, it’s now even easier to mark a message as flagged. I have tried the script, and it works as advertised. I would modify it to include only the latest message of a thread in the task note, but I see the appeal of having an entire conversation saved in OmniFocus for reference.

Obviously, the script is best enjoyed if executed on a Mac that’s running all the time. In this way, you can set a message as flagged on iOS, wait a few seconds, and find it in OmniFocus right away.

Personally, I run my own OmniFocus sync (every minute) so that I always have up-to-date sync that I can control. To implement this script in my workflow, I just had to create a new Keyboard Maestro macro (pictured above) that runs the AppleScript every minute if I’m logged in. In the way the script is designed, flagged messages are processed, then set back to “unflagged” so they won’t be added again in the future (unless you flag them manually).

You can find the AppleScript here.