Hi,
I know this has been done to some degree before, but attached is my (first ever) script for creating a Reminder from within Mail. It builds on other people’s effort of course. However, there’s a couple of things that I’d like it to do, which I just can’t seem to nail;
- when I use it, sometimes the result shows a very neat “Show in Mail” link in the body of the Reminder. But other times, and it seems it’s specific to the Sender of the email, I get a ‘message://3c<>’ unlinked body. I can’t figure out why - any help would be appreciated.
- I’ve got 2 dialogs in this script - Select the Reminder List, and Enter the Task Text. It would be nice to have once dialog with both fields on it, and a due date with a proper Calendar control - is this possible at all?
It could probably use a general tidy up - it’s been ages since I’ve coded.
Thanks,
E.
on run {input, parameters}
--Get Info from Mail
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 input to theMessage's subject
end tell
--Get the List to Save it to
activate application "Reminders"
tell application "Reminders"
set todo_lists to get every list
-- Reminder has a number of list across accounts, present them all
set numList to {}
set chosen to {}
# set list_list to ""
repeat with k from 1 to length of todo_lists
tell list k
if k > 9 then
set row_number to k
else
set row_number to "0" & k
end if
set end of numList to my row_number & ". " & name
end tell
end repeat
--Choose the List where the reminder will be created
set choices to choose from list numList with prompt "Hold the Command key down to make multiple choices." with multiple selections allowed
-- Extract the numbers only from the choices found in list "choices".
repeat with j from 1 to count choices
tell choices to set end of chosen to (text 1 thru ((my (offset of "." in item j)) - 1) of item j) as integer
end repeat
-- Return a list of item numbers
set k to item 1 of chosen
set myList to list k #{text 1 thru 1 of chosen_list}
--Get the Task Title
display dialog "What is the next Task?" default answer input
set task_desc to text returned of result
--Create the Reminder
set newremin to make new reminder with properties {name:task_desc, body:theurl, container:myList}
end tell
activate application "Mail"
return input
end run
Model: MBA
Browser: Safari 537.36
Operating System: Mac OS X (10.8)