Please note: This article has been contributed by a user.
This post is created by Moszi (www.moszi.net)
With Snow Leopard there is a possibility to create a so called Service for an application – and we can perform various actions in this service.
For instance we can create a service for Mail to link the selected message to Things - which is a great way of managing the messages we have to act on.
In this tutorial we are going to achieve the following: - create a service for Mail.app - write a script in this service that will link the currently selected message to Things - use the "Keyboard" preference pane to assign a shortcut to the new service
1. Launch Automator (Applications -> Automator, or use spotlight)
From the "Choose a template for your workflow" select Service, then click Choose.
2. In the top of the window select "no input" and "Mail.App" for the service properties, just as it is in this screenshot:
3. From the Utilities section in Library (on the left side) choose "Run Applescript" and drag this action onto the workflow.
4. Replace the "(* Your script goes here *)" text with the following:
UPDATE: ttul was so kind to provide another script which runs on multiple messages in a selection - if you would like to use that one, grab it here:
Script:MailToThings_MultiSelection.scpt
UPDATE2: Please check the notes below this article for more script fixes / ideas ;)
5. Save the service, and name it as "Link Selected Mail To Things"
At this point you should be able to see a new menu point in Mail under the Services menu called exactly the same way you named your service. Go ahead, select a message in Mail then click on this menu point - and a new todo item will be created in Things and the selected message already should appear as a link in the new todo's note field.
6. Now there is a trick you can do to invoke this service from a keyboard shortcut. Just open the Keyboard preference pane from System Preferences, then:
Now you have a nice shortcut in Mail to immediately link the message to things ;)
Comment by fabian:
Thanks for a great howto! This stopped me from filing a feature request for exactly this functionality...
One minor issue people may stumble upon: The script expects a list named "Mails To Answer" to exist in Things. If this doesn't exist it'll fail.
Comment by moszinet:
Hahh - you are absolutely right, the script will fail in this case. I've updated the script accordingly (I removed the line that adds the new todo to that list, now it is created in Today).
I also included an extra check for the case when the Message-ID is empty – unfortunatelly we cannot link the message to Things in this case ...
Thanks again for the comment :) - i'm really glad that somebody liked this :$ ...
Comment by pmhesse:
Rather than automatically add the task with a due date of today, I prefer popping up the "quick task entry" prepopulated, so I can adjust it before placing it in my task list.
To do this, in the Script:MailToThings.scpt, replace
set newToDo to make new to do ¬
with properties {name:theSender & " : " & theSubject}
set newToDo's due date to current date
set newToDo's notes to message_url
with
show quick entry panel ¬
with properties {name:theSender & ":" & theSubject, notes:message_url}
Enjoy!