View Single Post
I hacked together something that's working for me, based on
a couple other people's mail-into-ical scripts that have been
hashed around on the 'net for several years. Embarassingly I've
forgotten the original sources for major portions of the code,
so I can't give credit where it's due - only can say that most of
the bugs and kludges are mine.

http://idisk.mac.com/willray-Public?view=web

Download the mAil_tWo_iCal.scpt file.

You'll need to edit it internally to put it in an appropriate
calendar.

I have a "Penciled" calendar where I put incoming
tasks and possibly-scheduled items - OmniFocus is configured
to sync that with a "Penciled" context, which is used for nothing
except capturing that calendar. I also have OF configured to leave
tasks in the inbox until they've had both a context and a project
assigned, so things that land in Penciled, also show up in the
inbox. Requires the discipline to change the context when you
process your inbox, but that doesn't so far seem an impediment.

Mail has a rule set up to run this AppleScript whenever a message
with a subject starting with "Task : " appears in the inbox.

It has a second rule set up to move messages starting with "Task : "
into an archived tasks box.

These are set up as independent rules, because Mail, for reasons
impenetrable to me, has started arbitrarily reordering actions
inside rules. The script relies on the message being in the inbox
and being unread, and at least on my machine, when I try to add
a "move the message" action to the same rule that invokes the
AppleScript, Mail rearranges the actions and puts the "move" action
before the AppleScript action. (I'm pretty sure this is a new bug
in Leopard - rules didn't rearrange themselves previously, to the
best of my recollection).

Hmm - what else..

Ah, the script fills in the to-do task URL with the Mail message ID,
but Omnifocus re-writes that to be a URL to point to the OF task,
once it's synced it into the OF database. To make sure that you
can still get back to the Mail task, the script also writes the text of
the URL into the task note body - sometimes this appears clickable,
sometimes you need to highlight it and "go to URL". Either way,
it's an ugly URL, but I haven't taken the time to figure out how
to do a clip-o-tron-like URL-text redisplay, or rewrap the message
body in RTF, so that it shows up prettily in the note.

Oh, and the script's a bit cheeky, and still contains various debugging
bits that should be excised, and inelegancies that should be polished.
I of course am not making any warranties as to its utility, and don't
have that much time for maintenance, but I'll do my best to help
with setting it up, if there are questions. I'd also love to see
improvements, if anyone feels like banging on more functionality.

Good luck,
Will Ray