Looks like no one’s replied in a while. To start the conversation again, simply ask a new question.

automator for reminders from mail

It seems like it should be possible to create a reminder in ical from an email message (reproducing the "todo" functionality lost in the lion upgrade). I can manually create a reminder, then drag an email onto it, creating a link in the url field. I've tried creating a service to do this using automator, but I don't really know enough to pull it off. Any pointers would be appreciated.

Thanks.

Macbook, Mac OS X (10.4.10)

Posted on Oct 25, 2011 6:26 PM

Reply
Question marked as Best reply

Posted on Oct 26, 2011 7:18 AM

Can I answer my own question?

Here's an applescript that creates a reminder from an email, and inserts a url link to the email in the reminder. It inserts the body of the email into the "note" section of the reminder.


I've added this as a service to mail.app. I have to have some text selected in the body of the email in order to have the service available. Not sure why this should be. (I created the service to receive no input).


on run {input, parameters}

tell application "Mail"

set theSelection to selection

set theMessage to item 1 of theSelection

set theurl to "message://%3c" & theMessage's message id & "%3e"

set thedes to theMessage's content

set input to theMessage's subject

end tell


tell application "iCal"

tell calendar "YOUR CALENDAR HERE"

make new todo at end with properties {url:theurl, summary:input, description:thedes}

end tell

end tell

return input

end run

44 replies
Question marked as Best reply

Oct 26, 2011 7:18 AM in response to Chuck Kalish

Can I answer my own question?

Here's an applescript that creates a reminder from an email, and inserts a url link to the email in the reminder. It inserts the body of the email into the "note" section of the reminder.


I've added this as a service to mail.app. I have to have some text selected in the body of the email in order to have the service available. Not sure why this should be. (I created the service to receive no input).


on run {input, parameters}

tell application "Mail"

set theSelection to selection

set theMessage to item 1 of theSelection

set theurl to "message://%3c" & theMessage's message id & "%3e"

set thedes to theMessage's content

set input to theMessage's subject

end tell


tell application "iCal"

tell calendar "YOUR CALENDAR HERE"

make new todo at end with properties {url:theurl, summary:input, description:thedes}

end tell

end tell

return input

end run

Oct 29, 2011 2:25 PM in response to Chuck Kalish

Hi Chuck,


I'm really new to automator & apple scripts. But this is exactly what I have been looking for - a way to automatically fill out the url field in Lion's iCal reminder with the email header so I can open up the specific email from the ical reminder. Can you please let me know how you set up this script so when you select text in Mail & "control click", a window shows up with an option to create the reminder in iCal? Thanks.

Oct 29, 2011 4:59 PM in response to mihircon

Automator has the ability to run applescripts. Open automator, tell it you want to make a new "service", from the most used file of actions pick "run applescript". Paste my code into the script shell that automator creates.


Up at the top select "no input" for "service receives selected..."

Save with your favorite name.


In theory that shoudl make the service available anytime, but that hasn't worked for me. I need to have some text selected in the message to have the service appear in the menue. You can assign a keystroke to this new service in the keyboard system preference. I'm not sure how to add this service to the contextual menu that appears when you control click, but it should be possible.


Hope that helps.

-Chuck

Oct 30, 2011 1:05 AM in response to Chuck Kalish

Chuck - thanks. Was able to get this working. I have a calendar called "work", so used that for "your calendar here". Reminder shows up in iCal just like you describe, except get this error when iCal tries synching with the iCal service, & the reminder does not synch to icloud. Any ideas?


https://p02-caldav.icloud.com:443/[my ical ID]/principal/ is not a location that supports this request.


Gives me 2 options: Go offline, or Revert to Server.

Nov 8, 2011 6:25 AM in response to Chuck Kalish

I followed Mihircon's advise and managed to get the email r-click services working. I don't need to select text, but i do need to have my mouse over the body of the email to get the services menu.


Is it possible to open the reminder automatically in order to specify alarms, due dates etc?


If not I think I shall need to buy Mailhub.


thanks,

Phil

Nov 8, 2011 8:21 PM in response to Chuck Kalish

Chuck, great stuff and thanks. I am wondering how you may solve the issue with creating iCal Reminders from the new "Copy Note Link" functionality in Evernote released last week. This allows for Notes in Evernote to become url's that can be used in any application.


Here's what I think most are looking to do:


  • Evernote App (Assume I have copied a note link from the selected note) - the url is now on clipboard
  • Then... create an iCal Reminder that places the url (pasted from Clipboard) in the notes section of the reminder and allows user to type in title, date, choose calendar
  • The reminder now contains the url back to the Evernote Note (Copied url to clipboard) for easy reference


I know you can do this from the above script... no doubt.


Thoughts? Thanks so much!


Dean

Dec 8, 2011 5:05 AM in response to Chuck Kalish

A couple of things I noticed in getting this set up:


1. If you have calendars and reminder lists with the same names, it can be messy. Basically, iCal gets confused because it deals with calendars not on the basis of the text names we see, but on the basis of unique identifiers. One way to fix it is to rename your preferred reminders list so that it differs slightly from the calendar you have. This is the path (of least resistance) that I chose. Alternatively, you could run a few AppleScripts to interrogate your iCal database to work out the unique id that applies to your preferred reminders list and refer to that in the Applescript instead of the reminders list name.


2. If you want the focus to shift immediately to your newly created iCal reminder, simply add the word "activate" (no double quotes) after the second "end tell" line in the script (but before the third "end tell" line). This will make your Mac focus on iCal when the reminder is created.


This basic script can be extended significantly. I've stopped the script from populating the "notes" field of each reminder with the text of the email because that's what the link is for! I'll probably add a default priority level and a default alarm later on.


Thanks to all for their contributions - restoration of a most worthwhile feature.

Dec 8, 2011 5:10 AM in response to kennethfromfincastle

I think we're a little off topic, but I've pulled together what you're wanting.


To use, add the following to an Applescript block in a new service - created in the same manner as Chuck describes above:


on run {input, parameters}


set theLink to the clipboard


tell application "iCal"

tell calendar "Mundanities"

makenewtodoat end with properties {url:theLink ,summary:"New To Do"}

end tell

activate

end tell


return input

end run


Save the service and assign a keyboard shortcut to that service using the Services Preferences window. Open Evernote and Copy a Note Link, then press the keyboard shortcut.


If you don't like the focus of the window changing to iCal when you press the keyboard shortcut, comment out the link "activate" by putting a hash (#) in front of it and saving the Automator Service.


I hope that helps someone.

automator for reminders from mail

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple ID.