View Single Post
Hello. Been working on a project for a while and can't figure out a way to do this reliably. I've been using this Applescript (won't let me post URLs: to send flagged messages to Omnifocus, but the implementation is a little dumb. I'd like to be able to change the title and context of a task based on who's from or subject. I've sort of brute-forced this by making different Applescripts for each rule I want and making it run when getting the specified email.

I'll explain the use, I feel I'm being obtuse: I live on a college campus and use email for a ton of notifications (eg. package received at campus mail room, book ready to be picked up from library). I have my Macbook constantly running in my dorm, collecting these emails and ready to send them to Omnifocus, so for example I can look at the iPhone version of Omnifocus and see I should stop by the mail room to get my package while I'm out. Another use is Kickstarter "Response needed!" emails: I'd like to catch these and throw them into my Internet context.

What I've done is make a bunch of mail rules that automatically flag an email from, for example, the campus mail room, then run the appropriately edited above Applescript which throws an Omnifocus task with the "Mail Room" (or "Library," or "Internet") context and "Pick up package from mail room." (or "Pick up book from library," or "Respond to Kickstarter." title, with the body of the email in the notes section. This would work fine, except when I inevitably receive a mail room and a library email and the rule runs and there are either unnecessary or incorrect duplicate tasks made.

Is there a way to get the subject/from part of a flagged email in Applescript then change the title or context of the task accordingly, and do so for each flagged email? I can't figure it out.

I'm sure this could be applied to anyone who gets similar high priority emails. Thanks for any help, and if I'm at all unclear or obtuse please let me know. I'll clarify. Really looking for a solution.

Attached is an example of one of the Mail rules I use.
Attached Thumbnails
Click image for larger version

Name:	Snapshot 10:15:12 6:05 PM.png
Views:	1010
Size:	60.2 KB
ID:	2600