Reminder Script Stops in Yosemite

Guys,

This was all working fine in Mavericks, but has stopped as soon as I upgraded - and I use it ALL the time. So any help would be appreciated.

It stops towards the end on
set newremin to make new reminder with properties {name:task_desc, body:theurl, container:myList}

with error message
Syntax Error: Reminders got an error: AppleEvent handler failed.

Cheers.

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

Eamser/Donnel

I’m Sorry that I can’t help you here, but I have question for you about “get message id” here.

Can you confirm your below AppleScript workable in Mail? since I get result like (message://%3c<54476C88.5D3F7A.24383>%3e) for theurl, but it’s seems it can not be open by any apps.

How do you use below Script?


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

Hi reallulo,

Here’s an example I was playing around with. It creates a link to the Mail message in a TextEdit rtf document:

tell application "Mail"
	set theSelection to selection
	set theMessage to item 1 of theSelection
	set theSubject to theMessage's subject
	set messageID to theMessage's message id
	set theURL to "message:%3c" & messageID & "%3e"
end tell
set the clipboard to theURL
tell application "TextEdit"
	launch
	activate
	make new document at front with properties {name:"MailTest"}
	set text of front document to theSubject
end tell
tell application "System Events"
	keystroke "a" using command down
	keystroke "k" using command down
	keystroke "v" using command down
	keystroke return
end tell

Note that the “//” is optional.

gl,
kel

Hi eamser,

Sometimes you can make an object with initial read only properties. I think that in Reminders, you can’t set the ‘container’ property. I can’t remember if you could do it in Mavericks.

gl,
kel

Here’s a workaround:

tell application "Reminders"
	launch
	activate
	-- get the list where you want the new reminder to go to
	set theList to first list whose name is "Testing"
	--make the reminder in the default list
	set newRem to (make new reminder with properties {name:"NewTest", body:"hello"})
	-- move the remender to prefered list
	move newRem to theList
end tell

gl,
kel

Thanks for the ideas. I couldn’t get them to resolve the issue, but then stumbled upon the following which works great now. The Reminder Creation is rewritten to;

	--Create the Reminder
	tell myList
		set newremin to make new reminder with properties {name:task_desc, body:theurl}
	end tell

It seems Yosemite doesn’t like the container property in the creation statement, although I can’t prove that.

Hope this helps anyone else looking for it.