mutt to OmniFocus

June 26th, 2009  |  Published in ruby  |  1 Comment

Tmail is handy if you’d like something that can parse an e-mail message and do something with it, in this case handing it off to OmniFocus:

#!/usr/bin/env ruby



require 'rubygems'

require 'tmail'

require 'appscript'

include Appscript



of = app('OmniFocus')

message = STDIN.read

mail = TMail::Mail.parse(message)

tasks = of.documents[1].get

tasks.make(:new => :inbox_task, :with_properties =>\  

  {:name => mail.subject, :note => mail.body})

“But OmniFocus already has the Clip-o-Tron 3000! I don’t need to pipe a message into some Ruby script to get it into OmniFocus,” you might reasonably be expected to say.

That’s true!

Might be handy in mutt, though.

Actually, I’m not even using mutt right now. But Mail.app just did one of its infuriating “I’m going to sit here pretending to check your mail but not really do it, ‘kay? Force-quit me when you’ve had enough!” things that it does now and then and I thought “Were I to just go be a savage for a week, what thing would I most miss about Mail?”

Getting things into OmniFocus was lower on the list than “instant Spotlight searches of all my messages,” “smart mailboxes,” and “being able to quick-look attachments right there in the client,” but I’ve already bashed my head against virtual folders and search in mutt and found it painful, and I’ve written something that let me quick-look attachments in mutt should I ever care to go dust it off and assign it to a hotkey. So “get this message into OmniFocus” was the one thing I could think of to actually try.

Having considered it and shared it with you, I’ve cooled down enough to relaunch Mail and live with it for another month.

Responses

  1. Ed Heil says:

    June 26th, 2009 at 3:59 pm (#)

    Hey, look what just had two new releases this past month…

    http://rubyforge.org/pipermail/sup-announce/2009/date.html

Leave a Response

© Michael Hall, licensed under a Creative Commons Attribution-ShareAlike 3.0 United States license.