Adding Waiting For Mail to OmniFocus by AppleScript
I really like my @waiting list. It's a great place for me to see who all these fellows are that still owe me. But one of the problems I have is that most requests I make are based on emails I sent. Taking the extra effort to add a task for each email to OmniFocus feels very much like defeating the purpose of personal productivity. So I started to track eMail Waiting Fors separately in Mail.app using MailTags and a Smart Mailbox. I simply tag each email with a request with my "@Waiting" tag and regularly review the related Smart Mailbox.
But during reviews it is actually quite hard to link back the waiting for emails from Mail.app with the individual projects in OmniFocus. Consequently I have looked for an alternative way to automatically get "Waiting For" emails tracked inside of OmniFocus and came up with this AppleScript that does the job nicely and automated.
Script functionality
The script get invokes by an Mail.app outbox rule which uses MailTags to filter on those out going mails that have been tagged as "waiting for". It then takes the message and creates a task in the OmniFocus Inbox called "<email recipient> to come back re <email subject>". The text between the email recipient and the email subject can be configured easily in the script.
The script only looks at the 'To' recipients and ignores and 'CC' or 'BCC' recipients. If the mail is going out to multiple recipients (which can happen, but isn't ideal when delegating actions) it will only show the first recipient's name and will add "and x more" where x will be the number of additional recipients.
A reference link to the original message is posted to the task's note section. You can optionally configure if you like the entire email body to be posted into the task's notes section as well.
The task created in the OmniFocus Inbox gets also automatically associated with your OmniFocus "waiting for" context which you need to reference in the script configuration section.
Finally the script uses Growl, if installed and running, to notify you about the successful addition of the "Waiting For" task to OmniFocus.
Installation of the script
- You will require MailTags from Indev to later built the proper Mail.app outbox rule
- Download the script and copy it into your standard script directory, e.g. ~/Users/<your username>/Library/Scripts/
- Modify the script configuration based on your needs and setup
- Create a outbox rule in Mail.App that invokes the script if specific conditions, i.e. MailTags Keyword of the message is "@Waiting", are met
Customising the key parameters
Inside the script you can and very likely should change some configuration properties to match your requirements and setup.
property mailBody : true- You should change this setting to 'false' if you do not want the entire body text of the email to be pasted into the OmniFocus task's note section.property MidFix : "to come back re"- Change this text to whatever you like to see in the task title between the email recipient's name and the email's subject.property myWFContext : "Waiting"- This variable needs to exactly match the name of the context in OmniFocus that you'd like to use for "Waiting For" items, i.e. "Waiting".
Creating the outbox rule in Mail.app
Next you need to create a outbox rule in Mail.app that looks similar to the one below. Again MailTags will be required to perform this action.

You should be good to go and all the eMails you now tag with your "Waiting For" tag before sending them out will nicely get added to your OmniFocus Inbox.
Update: I modified the script so that message URL back link works and reveals the correct message within Mail.app