Ted Wise header image 2

Integrating The Hit List with Mail.app 

Copy ShortURL

March 14th, 2009 · View Comments · Mac

Here's a simple Applescript program to create The Hit List tasks from Mail.app mail messages. It will create them in the Hit List Inbox with a start date and notes taken from the body of the mail message.

 
tell application "Mail"
	try
		set theSelection to the selection
		if the length of theSelection is less than 1 then error "One or more messages must be selected."
		repeat with theMessage in theSelection
			my importMessage(theMessage)
		end repeat
	end try
end tell
 
on importMessage(theMessage)
	tell application "Mail"
		try
			set theSubject to subject of theMessage
			set theDate to date received of theMessage
			set messageURL to "Task created from mail message:%3c" & (message id of theMessage) & "%3e"
			set theBody to messageURL & return & return & the content of theMessage
			tell application "The Hit List"
				tell inbox to make new task with properties {title:theSubject, notes:theBody, start date:theDate}
			end tell
		end try
	end tell
end importMessage
 

Copy the above text or download the script file

I use it by setting up a keystroke using Spark that only applies in Mail.app. It makes it trivially easy to create tasks from mail messages.

If you haven't seen The Hit List yet I highly recommend it. Not only does it work well but it's even beautiful to look at.

Updated: Used Andy Kim's version with the single addition of the start date.


Share and Enjoy:
  • email
  • Twitter
  • Facebook
  • Slashdot
  • LinkedIn
  • Digg
  • DZone
  • Reddit
  • Paul
    Thanks, Ted, for this script!

    I wanted to integrate this with Mail.app Rules in order to have tasks automatically created under certain conditions, so I created a modified version of your script using "perform mail action with messages." Check it out:

    using terms from application "Mail"
    on perform mail action with messages newMessages
    repeat with theMessage in newMessages
    tell application "Mail"
    try
    set theSubject to subject of theMessage
    set theDate to date received of theMessage
    set messageURL to "Task created from mail message:%3c" & (message id of theMessage) & "%3e"
    set theBody to messageURL & return & return & the content of theMessage
    tell application "The Hit List"
    tell inbox to make new task with properties {title:theSubject, notes:theBody, start date:theDate}
    end tell
    end try
    end tell
    end repeat
    end perform mail action with messages
    end using terms from
  • Shannon Sullivan
    Can anyone help me set this up? I installed Spark and created and now shortcut to run the above applescript file, but it's not working. Probably because I'm a nub and have no idea what I'm doing.
  • Thanks a lot for this script. It does just what I want it to. I also set it up with a Quicksilver trigger.
  • See this line: 'set theSubject to subject of theMessage'? You can write some AppleScript to parse out the text you don't want at the beginning and then change the line to 'set theSubject to myfixedupsubject'.
  • Renee
    Thanks, this is just what I was looking for. I am using reQall to capture to-dos on the go - I have them sent to my email inbox and then now use your script as a rule to send it straight to THL inbox as a dump. I just had it remove the start date so that I can set that as I file it. Quick question - is there a way to set the script to "exclude" the "Added:" text that reQall automatically puts in the subject line over every email? Thanks!
  • WOW! This is SO seamless! I didn't even realize that the Quicksilver trigger I'd applied to the script even worked until I saw that I'd accidently posted the same email to THL 3 times from hitting the shortcut again and again. Thanks for writing this little script. The only thing that could make it better would be an option to choose which List to add the message to instead of dropping it loose in THL inbox.
    Way easier than copy/paste though!
blog comments powered by Disqus