Script to create reminder from email message

Sharing and discussing custom actions for LaunchBar
Post Reply
sabdal
Rank 1
Rank 1
Posts: 33
Joined: Wed Jun 18, 2008 4:49 pm

Script to create reminder from email message

Post by sabdal » Wed Jun 05, 2013 6:33 pm

It is possible to drag/drop an email into Reminders.app. You can drag it to a particular list as well and it goes there.

I would love script I can use from LB to take the message, drop it into a particular reminders list, and also make the reminder the subject line of the email (which it does if you drag and drop). On drag and drop, it also puts a "Show in mail" link in the notes.

THanks!

sabdal
Rank 1
Rank 1
Posts: 33
Joined: Wed Jun 18, 2008 4:49 pm

Re: Script to create reminder from email message

Post by sabdal » Mon Sep 30, 2013 8:53 pm

Ok. so I struggled and did most of this myself. It works ok, but I'm a newbie. Any improvements would be appreciated.

I wanted it to allow you to pick a Reminders List from a popup, but I don't have time to figure it out.

I wrote some script language to ask for input of the list you want, but that keeps resulting in an error when I tell a specific list to create a new reminder. I'm doing something incorrectly but don't know how to fix it. If this works for you and you can improve it, please post.

Thanks!

[Code]tell application "Mail"
--get selected messages
set theSelection to selection

set newline to ASCII character 10
set formatBody to ""
repeat with theMessage in theSelection

--get information from message
set theMessageDate to the date received of theMessage
set theMessageSender to sender of theMessage
set theMessageSubject to the subject of the theMessage
set theMessageContent to the content of theMessage
set msgBody to content of theMessage
set msgID to message id of theMessage
set theMessageURL to "message://%3c" & theMessage's message id & "%3e"

--display dialog "Enter list" default answer ""
--set listInput to text returned of result
--set mylist to list listInput

display dialog "Enter # of Days Until Reminded" default answer 1
set reminderDays to text returned of result as number

--import message to Reminders
tell application "Reminders"
--tell mylist

make new reminder with properties {name:theMessageSubject, body:"From: " & theMessageSender & formatBody & "message://%3c" & msgID & "%3e", due date:((current date) + reminderDays * days)}

--end tell
end tell
end repeat
end tell[/code]

Post Reply