Add a task to Things from anywhere!

Jun 05, '09 07:30:00AM

Contributed by: binaryghost

Like many, I recently had the urge to organize my life. I decided this time I would be serious about it and enlist some GTD apps to assist me. From the collection of apps I tried, my favorite was Things by CulturedCode. There are many features I love about this app, but one feature I wish it had was the ability to email myself tasks. This was something I really liked about Remember the Milk.

I decided to create an AppleScript the would take specially-formatted emails that arrive in Mail.app and convert them into tasks within Things. The subject line becomes the task name, and the content of the email becomes the notes associated with the task. I detailed the full process on my blog (with screenshots), but here's the executive summary version:

  1. Create this AppleScript, and save it to /Library » Scripts » Mail Scripts as things.scpt:
    (* Things GTD app Remote Task Creation v.1
    By: Don Southard aka. Bin@ryGh0st... Thursday June 4, 2009 *)
    
    using terms from application "Mail"
      on perform mail action with messages MessageList for rule Things
        tell application "Mail"
          activate
          set thisVar to (count message viewers)
          if (count message viewers) = 0 then make new message viewer
          set thisMessage to item 1 of MessageList
          set taskName to the subject of thisMessage
          set taskDesc to the content of thisMessage
          move thisMessage to mailbox "Trash"
          if thisVar = 0 then quit message viewer 1
          tell application "Things"
            set newToDo to make new to do with properties {name:"New to do"} at beginning of list "Inbox"
            set name of newToDo to taskName
            set tag names of newToDo to "Email"
            set notes of newToDo to taskDesc
          end tell
        end tell
        
        tell application "System Events"
          set processID to name of every process
        end tell
        if "GrowlHelperApp" is in processID then
          tell application "GrowlHelperApp"
            set the allNotificationsList to {"Things Notification"}
            set the enabledNotificationsList to {"Things Notification"}
            register as application "Remote Things Script" all notifications allNotificationsList default notifications enabledNotificationsList icon of application "Things"
            notify with name "Things Notification" title taskName description taskDesc application name "Remote Things Script"
          end tell
        end if
      end perform mail action with messages
    end using terms from
    
  2. Add a rule named Things to Mail.app to run the script when a coded email arrives. I personally chose to add an @ symbol to the beginning of the subject line to let Mail know to convert it in to a task. You can choose any symbol or criteria in your rule, just as long as it runs the script. I also chose to mark it as read and the script moves it to the trash since I don't need these tasks cluttering up my inbox.
That's it! New emails that match the criteria will be converted to tasks and dropped in to the 'Inbox' in Things.

[robg adds: I've recreated the code here in case the original ever vanishes, but the best source is the linked blog entry -- any updates to the code will be found there, not here. I haven't tested this one.]

Comments (5)


Mac OS X Hints
http://hints.macworld.com/article.php?story=20090604212405566