More results...

Generic selectors
Exact matches only
Search in title
Search in content
Post Type Selectors

More results...

Generic selectors
Exact matches only
Search in title
Search in content
Post Type Selectors

Tech Talk: Applescript From Mac Mail To OmniFocus With Link To Original Mail

Propeller Beanie hatWARNING!!!! On a geek-scale of 1 to 10, this post is pushing past 11. This is coding. Not very advanced coding, but coding nonetheless. So if you’re looking for the usual Israellycool greatness about Israel, try almost any other post.

Good, you’re still here, and I hope you’ve put on your propeller hat so we can continue.

To manage my increasingly hectic life I use a program called OmniFocus by OmniGroup which allows me to manage the various things I have to do according to the philosophy laid out in the book “Getting Things Done” by David Allen. It may not be an exaggeration to say this changed my life. OmniFocus runs on my Mac and syncs with my iPhone. This is not free software, I’ve paid for it but it’s essential to me.

I’m not going into the details of these things but here’s what I wanted to do: when some emails come into any of my multiple inboxes (I have 5  separate google mail accounts that are in regular use) I wanted to be able to flag (manually) any of these on any of the many devices I check mail for later action in OmniFocus.

I also wanted to maintain a link to the original email that would work on both my Mac and my iPhone. This is incredibly useful so if I need to reply later, I can click and get straight to the correct email thread.

I came up with a system that works for me and may work for other so, in the interests of being a good netzion I’m putting it out there.

Here’s my system:

  1. Mail arrives: Gmail runs some automatic filters and automatically labels some mail.
  2. I read it: if I need it to be dealt with in a more comprehensive way (and the automatic rules didn’t catch it) I label it or move it to a special folder called [flag-omni]. The square brackets are in the label name. I can do this on ANY device and ANY mail app I’ve tried across mac, web and iPhone.
  3. I run an applescript on my Mac: I could automate this but I prefer to run it from the keyboard (via QuickSilver) when I’m sitting at my Mac.
  4. The Script goes through all the [flag-omin] folders in all my mailboxes, moves items into OmniFocus including (and this was a hard part) a direct link to the original email that works in Apple’s Mail system including back over on the iPhone. It makes sure it won’t double move the same item to OmniFocus by flagging (in blue) messages it’s dealt with.
  5. Infrequently I go into the web gmail interface and remove the [flag-omni] label: there doesn’t seem to be a way to do this properly on Mac Mail via applescript so it’s best to do this manually every so often. If you know different, let me know!

So here’s the things you need to do:

Set up a label in gmail or a folder in Mac mail and call it [flag-omni] with the square brackets.

Download this AppleScript (right click download linked file): Move Actions and send to Omni v003 or run the Applescript editor copy and paste into a new Applescript.

There’s one bit you should look at and change near the end of the script:move to omnifocus applescript screenshot

This bit lets me add a project, context and due date to certain messages so they bypass the OmniFocus Inbox. If you’re still here, you’ll understand what that bit is useful for!

Good luck and please let me know in the comments if this works for you and you find it helpful!

About the author

Picture of Brian of London

Brian of London

Brian of London is not the messiah, he's a very naughty boy. Since making aliyah in 2009, Brian has blogged at Israellycool. Brian is an indigenous rights activist fighting for indigenous people who’ve returned to their ancestral homelands and built great things.
Picture of Brian of London

Brian of London

Brian of London is not the messiah, he's a very naughty boy. Since making aliyah in 2009, Brian has blogged at Israellycool. Brian is an indigenous rights activist fighting for indigenous people who’ve returned to their ancestral homelands and built great things.
Scroll to Top