Creating an iCal Reminder from Apple Mail & Syncing with iCloud

I have attempted to “Go Native” with my Apple ecosystem, which consists of an iMac and MacBook Pro running Apple OS X Lion and an iPhone 4S running iOS 5, trying to use built-in functionality rather than third-part applications. That includes the decision to use Mac OS’s built-in Reminders in lieu of Things, especially given that Cultured Code will ostensibly roll out cloud syncing in the same timeframe it took 3D Realms to release “Duke Nukem Forever” .

I was rather dismayed to discover that Apple had removed the ability to create new To-Do’s from Apple Mail in Lion. Never one to let something like the absence of a feature deter me, I did some research and cobbled together a script using code from StackExchange. For some reason I still do not entirely understand, the script would only create reminders in the Birthday calendar, entries that were decidedly difficult to remove. Thanks to some assistance from MacTech, I zeroed in on how to specify the proper calendar to which to add the reminder. 

Without further ado, here’s the AppleScript. I’ve done some limited testing, and it creates To-Do’s (or, rather, Reminders as they’re now called in iCal) that sync via iCloud to my iPhone. This can be run from the Scripts menu, once enabled, or bundled into a Service via Automator and run from a keyboard shortcut.

tell application “Mail”

set theSelection to selection

set theMessage to first item of theSelection

set theSubject to subject of theMessage

set theDescription to “From : ” & sender of theMessage

set theMessageId to message id of theMessage

set theUrl to “message:%3C” & message id of theMessage & “%3E”

end tell

tell application “iCal”

make todo at end of events of (first item of calendar “Reminders”) with properties {summary:theSubject, description:theDescription, url:theUrl}

end tell

 

5 comments on “Creating an iCal Reminder from Apple Mail & Syncing with iCloud”

  1. Perfect, thanks!

  2. what do I select in the drop down menu next to “service receives selected:”?

    1. You shouldn’t have to change anything. On my machine, the default is, “Service receives in . Not sure if this explanation makes sense, but I don’t believe that keyboard input is considered an “input” with respect to Automator. Once you’ve created and saved the service, you can trigger it from the Mail->Services menu, or you can open the Services preferences and assign a keystroke to it (which is what I did).

  3. My apologies, I’m a script-newb, however totally miss this function. Sadly running into some problems. Copy&past’d your script text into Automator as a ‘Run Shell Script’ workflow (see screenshot). I head over to Mail, highlight a subject line and run the script from the Services menu, but then get the message “The action “run shell script” encountered an error”. Any tips/suggestions? Thanks for your work/help!

    1. It’s not a ‘Run Shell Script’ Workflow; it’s a ‘Run AppleScript’ workflow. You can email me at brian [at] unqualified [dot] org if you have any other questions.

Say Something

Your email address will not be published. Required fields are marked *