I’m trying to repair an iCal AppleScript I used under Leopard that has now broken under Snow Leopard, and I think I’ve found the problem, but I don’t know how to fix it. The line below returns an error with the “open file alarms” section.
tell application "iCal" to set convertMePosList to uid of (every event in thisCal whose open file alarms is not {} and start date is less than or equal to (current date) + 20 * minutes)
I am now about 90% sure that it is misrecognizing “open file alarms” as a Class instead of a Property, as it should be. (It is blue and italicized, instead of purple and not). The problem is, “open file alarms” seems to be both…
How do I tell AppleScript to treat it as a Property rather than a Class? I am a severe AppleScript noob, so any help you can offer would be greatly appreciated!
tell application "iCal"
set convertMePosList to (every event in calendar thisCal whose start date is less than or equal to (current date) + 20 * minutes)
set uidList to {}
repeat with i from 1 to count of convertMePosList
set thisItem to item i of convertMePosList
if (count of thisItem's open file alarms) > 0 then
set end of uidList to thisItem's uid
end if
end repeat
end tell
Quick syntax question: what does the “{}” signify in the line I quoted? Does it translate as “whose open file alarm is not blank”? Or does “{}” mean something specific in Applescript?
‘Open file alarms’ are elements of an event, not a property. (A property is a value associated with an object; an element is another object contained by the object.) It doesn’t explicitly say so in the AppleScript Language Guide, but I think that filters are only supposed to test item properties. That they sometimes work with elements is something on which I wouldn’t like to rely.
So you’re saying it might have been an accident that it worked in Leopard, and then in Snow Leopard it got “fixed” so it doesn’t work anymore? Am I understanding that right (pardon my noobdom)?