What's wrong with this syntax?

I’m fetching some iCal todo items returned as a list. This works peachy and I get a list object that looks like:

{todo 1 of calendar 5 of application "iCal", todo 2 of calendar 5 of application "iCal"}

All good so far. Now I want to set a variable to that todo and I try:

set temp to (todo 1 of calendar 5 of application "iCal")

But this fails. I know this works:


tell application "iCal"
set temp to (todo 1 of calendar 5)
end tell

Is it necessary to break up the return value of (todo 1 of calendar 5 of application “iCal”) and parsing out the calendar name, then reforming it into a tell application block or am I missing some step in using the entire string?

ideally, I just want to do something like this:


repeat with theToDo in todoList
tell theToDo
set dueDate to (get due date) as string
set description to (get description) as string
end tell
end repeat

and so on

Hi,

you need a tell block to resolve the terminology of iCal

tell application "iCal"
set temp to (todo 1 of calendar 5)
end tell

or you can use alernatively

using terms from application "iCal"
	set temp to (todo 1 of calendar 5 of application "iCal")
end using terms from

but for your last example you need the application tell block to talk to the application

tell application "iCal"
	repeat with theToDo in todoList
		tell theToDo
			set dueDate to (get due date) as string
			set theDescription to (get description) -- it's (Unicode) text anyway
		end tell
	end repeat
end tell

Awesome!

I’m writing a filter in an Automator task and this is working just perfect:


on run {input, parameters}
	tell application "iCal"
		repeat with theToDo in input
			tell theToDo
				set dueDate to (get due date) as string
			end tell
		end repeat
	end tell
end run