i have ipod touch and i add events to my calendar via my ipod. the problem is all event seems to go to one calendar named “Home.”
so i wanted to write a script that will grab all events from “Home” and put them into appropriate calendar.
I entered in “calendarName-eventTitle” as event title and parsed it around “-” and was able to get {“calendarName”,“eventTitle”}.
First I tried to move the event to new calendar, but there seem to be no build functionality to do that.
So i decided to create new event in the appropriate calendar and delete the event in “Home” calendar.
i created a new handler makeEvent(names, currEvent) where names={“calendarName”,“eventTitle”} and currEvent is the event in “Home” calendar.
i was trying to access appropriate destination calendar using “set newCal to calendar whose name is (item 1 of names)” but it said it couldn’t find the calendar with that name even though i see that it actually does have a calendar with same name.
what am i doing wrong? how do i access calendar in iCal using it’s name?
p.s. here’s my makeEvent handler
on makeEvent(names, currEvent)
tell application “iCal”
set newCalName to (item 1 of names) as text
set newCal to calendar whose name is newCalName
tell calendar newCal
make new event at end with properties {description:desc, start date:(currEvent’s start date)} --, end date:(currEvent’s end date), allday event:(currEvent’s allday event), recurrence:(currEvent’s recurrence), sequence:(currEvent’s sequence), excluded dates:(currEvent’s excluded dates), status:(currEvent’s status), summary:(item 2 of names), location:(currEvent’s location), url:(currEvent’s url)}
end tell
end tell
end makeEvent