iCal moving events to calendar not working
iCal moving events to calendar not working
- Subject: iCal moving events to calendar not working
- From: "David A. Cox" <email@hidden>
- Date: Thu, 24 Jul 2008 16:51:55 -0700
I am trying to look at a calendar (imported into iCal) and move the
events to set of other calendars depending on my attendance status for
the meeting. But when I run the script (a condensed version of it
below), the events often move to the wrong calendar, and then either
disapear after a moment, or disapear if I quit iCal and launch it again.
Looking the console, I see lots of errors of the form:
Error Domain=NSCocoaErrorDomain Code 1570 UserInfo =0x71934f0
"calendar is a required value."
Any insight as to a better way to do this would be much appreciated
(as would an answer to just what sort of oddness is going on).
The simplified (still shows this problem) version of the script is:
set MyCalName to "David Cox"
set Calname to "MyCal"
set Calname4Declined to "-Declined"
set Calname4Undecided to "-Undecided"
set Calname4TentativeAccepted to "-Tent"
set Calname4TentativeDeclined to "-Tent-Declined"
set Calname4Tentativeundecided to "-Tent-Undecided"
with timeout of 90 seconds
tell application "iCal"
set CalEvents to events of calendar Calname
repeat with i from (count CalEvents) to 1 by -1
set MoveToDelete to false
set MoveToUndecided to false
set TentativeStatus to false
set e to item i of CalEvents
if e's status is tentative then
set TentativeStatus to true
end if
set {theAttendees} to e's {attendees}
repeat with j from 1 to (count theAttendees)
set CurrentAccount to item j of theAttendees
if display name of CurrentAccount is MyCalName then
set MyStatus to participation status of CurrentAccount
if MyStatus is declined then
set MoveToDelete to true
else if MyStatus is unknown then
set MoveToUndecided to true
end if
end if
end repeat
if TentativeStatus is true then
if MoveToDelete is true then
delete e's display alarms
delete e's open file alarms
delete e's sound alarms
move e to end of events of calendar Calname4TentativeDeclined
else if MoveToUndecided is true then
delete e's display alarms
delete e's open file alarms
delete e's sound alarms
move e to end of events of calendar Calname4Tentativeundecided
else
move e to end of events of calendar Calname4TentativeAccepted
end if
else
if MoveToDelete is true then
delete e's display alarms
delete e's open file alarms
delete e's sound alarms
move e to end of events of calendar Calname4Declined
--end if
else if MoveToUndecided is true then
delete e's display alarms
delete e's open file alarms
delete e's sound alarms
move e to end of events of calendar Calname4Undecided
end if
end if
end repeat
end tell
end timeout
_______________________________________________
Do not post admin requests to the list. They will be ignored.
AppleScript-Users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
Archives: http://lists.apple.com/archives/applescript-users
This email sent to email@hidden