Hi guys,
I’m primarily a perl dude. Every once in awhile I struggle through an apple script. I’m stuck on this one. I’m sure it’s simple, so please excuse my ignorance. This script I wrote used to work, but stopped working awhile back (perhaps when I upgraded to 10.5?)… I get an error in this section:
tell application "iCal"
set theCalendar to (the first calendar whose title is calName)
tell calendar theCalendar
--make the event
set newevent to make event at end of events of theCalendar with properties {summary:eventName, start date:eventStart, end date:eventEnd, location:eventPlace, description:eventDescription, url:eventUrl}
end tell
end tell
The error is:
iCal got an error: Can't make calendar id "938ABBFC-08A7-4E0E-887B-309278A47C97" into type integer.
Anyone know what the problem is?
Thanks,
Rob
Hi,
too many double references
theCalender contains a reference to the filtered calendar.
this syntax is wrong
tell calendar theCalendar
use either
tell theCalendar
or
tell calendar calName
In the make event line is also a double reference (of theCalendar)
This is sufficient
tell application "iCal"
tell calendar calName
--make the event
set newevent to make event at end of events with properties {summary:eventName, start date:eventStart, end date:eventEnd, location:eventPlace, description:eventDescription, url:eventUrl}
end tell
end tell
Awesome. Thanks. That worked. I think I’m gonna like macscripter.net. (I’m new here.)
Rob
As a historical footnote, calendars had ‘titles’ in iCal 1.0, so the ‘whose’ filter would have been required then. (But as Stefan has pointed out, the rest of the script was incorrect anyway.) Calendars have had ‘names’ since iCal 2.0 and so can be specified in the form ‘calendar calName’.