Error deleting events in iCal using applescript

Hi,
I made a little applescript to insert and remove a roster in iCal for me and my collegues.
While the script to remove a roster works fine on my computer, others are getting an error:
see Link: [http://i359.photobucket.com/albums/oo31/Bronco_Dappe/Allerlei/Afbeelding1.png]
[the error contains some strange characters but in general it says:
"can not get class ... of event id ... of calendar id ..."]
My applescript to delete the roster is:
on run {CalendarName, Start, Eind, Prefix}
-- Start and Eind format:
-- int(day) int(month) int(year) int(hour) int(minutes)
-- ===============================
on run
set CalendarName to "MP"
set Start to "15 10 2009 00 00"
set Eind to "17 10 2009 23 59"
set Prefix to "MP:"
-- Version 3.0
-- ========
-- Changed format of Start & Eind to be compatible with Snow Leopard
-- convert DateStart
set wordsplit to (words in Start)
set DateStart to (current date)
set year of DateStart to (item 3 of wordsplit)
set time of DateStart to 0 -- reset time
set day of DateStart to 1 -- prevent february 31
set month of DateStart to (item 2 of wordsplit)
set day of DateStart to (item 1 of wordsplit)
set DateStart to DateStart + ((item 4 of wordsplit) * hours + (item 5 of wordsplit) * minutes) -- set time
-- convert DateEind
set wordsplit to (words in Eind)
set DateEind to (current date)
set year of DateEind to (item 3 of wordsplit)
set time of DateEind to 0
set day of DateEind to 1
set month of DateEind to (item 2 of wordsplit)
set day of DateEind to (item 1 of wordsplit)
set DateEind to DateEind + ((item 4 of wordsplit) * hours + (item 5 of wordsplit) * minutes)
tell application "iCal"
set TargetCalendar to first calendar whose title is CalendarName
set list2bDeleted to {}
set list2bDeletedSum to {}
set listEvents to every event of TargetCalendar
repeat with singleEvent in listEvents
if summary of singleEvent starts with Prefix then
set eventstart to start date of singleEvent
if eventstart ≥ DateStart and eventstart ≤ DateEind then
if summary of singleEvent starts with Prefix then
copy uid of singleEvent to end of list2bDeleted
copy summary of singleEvent to end of list2bDeletedSum
end if
end if
end if
end repeat
repeat with eventUID in list2bDeleted
delete (every event of TargetCalendar whose uid is eventUID)
end repeat
end tell
return list2bDeletedSum
end run
In general the script works like this:
1. it goes over events in a specified calendar
2. all events to be removed are added to a delete-list by id
3. all events in the delete-list are removed using this id
it seems step 3 creates a problem.
any suggestions here?
ghislain
Message was edited by: ghis74

Once I got access again to an apple with Leopard I solved the problem.
The applescript was saved in Snow Leopard.
When opened in Leopard 'uid' in 'copy uid of singleEvent to end of list2bDeleted' was changed into '<<class>>' : 'copy <<class>> of singleEvent...'.
Quite strange - but correcting and saving the script in Leopard solved the problem.
Thanks for your help.
Ghislain

Similar Messages

  • Weird order of events added to iCal using Applescript

    This is a script that has worked perfectly in the past and as far as I know has not been modified (my bad if so...) Currently it is adding all the correct events into iCal but taking a real long time to do it and this is probably due to the weird chronology it takes to putting the events in. I will include the script at the bottom of this post and here is a section of the event log that shows the weird chronology... Thanks in advance for the help.
    dan
    count every event of calendar "School Calendar 09-10"
    176
    get summary of item 1 of every event of calendar "School Calendar 09-10"
    "Day 5"
    get summary of item 1 of every event of calendar "School Calendar 09-10"
    "Day 5"
    get start date of item 1 of every event of calendar "School Calendar 09-10"
    date "Monday, April 5, 2010 12:00:00 AM"
    make new event at end of calendar "Classes2" with properties {summary:"Alg I period 2", start date:date "Monday, April 5, 2010 9:30:00 AM", end date:date "Monday, April 5, 2010 10:25:00 AM"}
    event id "879D03C6-24CE-49C8-AB3B-D216FF4CF148" of calendar id "186E5DE2-8E33-492F-9F76-D0EF292B98D8"
    make new event at end of calendar "Classes2" with properties {summary:" Pre Calc B period 3", start date:date "Monday, April 5, 2010 10:30:00 AM", end date:date "Monday, April 5, 2010 11:25:00 AM"}
    event id "1AF62B85-F074-4E93-A03F-89CFD79A59A6" of calendar id "186E5DE2-8E33-492F-9F76-D0EF292B98D8"
    make new event at end of calendar "Classes2" with properties {summary:" IB Math period 4", start date:date "Monday, April 5, 2010 11:30:00 AM", end date:date "Monday, April 5, 2010 12:25:00 PM"}
    event id "CCB9EE0D-870E-43EA-AA39-3DAE2BCB23F8" of calendar id "186E5DE2-8E33-492F-9F76-D0EF292B98D8"
    get summary of item 2 of every event of calendar "School Calendar 09-10"
    "Day 3"
    get summary of item 2 of every event of calendar "School Calendar 09-10"
    "Day 3"
    get start date of item 2 of every event of calendar "School Calendar 09-10"
    date "Monday, April 19, 2010 12:00:00 AM"
    make new event at end of calendar "Classes2" with properties {summary:" Pre Calc F period 1", start date:date "Monday, April 19, 2010 8:30:00 AM", end date:date "Monday, April 19, 2010 9:25:00 AM"}
    event id "F8A5B643-7758-437B-919E-65C0EBF043EA" of calendar id "186E5DE2-8E33-492F-9F76-D0EF292B98D8"
    make new event at end of calendar "Classes2" with properties {summary:"Alg I period 3", start date:date "Monday, April 19, 2010 10:30:00 AM", end date:date "Monday, April 19, 2010 11:25:00 AM"}
    <pre style="
    font-family: Monaco, 'Courier New', Courier, monospace;
    font-size: 10px;
    margin: 0px;
    padding: 5px;
    border: 1px solid #000000;
    width: 720px; height: 340px;
    color: #000000;
    background-color: #FFDDFF;
    overflow: auto;"
    title="this text can be pasted into a HTML editor">
    tell application "iCal"
    ---------This is where you gather / set user data
    display dialog "How many courses do you teach?" default answer ""
    set courses to the text returned of the result as number
    set slotA to ""
    set slotB to ""
    set slotC to ""
    set slotD to ""
    set slotE to ""
    set slotF to ""
    set slotG to ""
    set slotH to ""
    repeat with x from 1 to courses
    set entered to text returned of (display dialog "Please enter the slot (A-H) and the course name, separating them with a comma:" default answer "")
    set astid to AppleScript's text item delimiters
    set AppleScript's text item delimiters to ","
    set {chosenslot, chosencourse} to {(entered's text item 1), (entered's text item 2)}
    if chosenslot is "A" then
    set slotA to chosencourse
    end if
    if chosenslot is "B" then
    set slotB to chosencourse
    end if
    if chosenslot is "C" then
    set slotC to chosencourse
    end if
    if chosenslot is "D" then
    set slotD to chosencourse
    end if
    if chosenslot is "E" then
    set slotE to chosencourse
    end if
    if chosenslot is "F" then
    set slotF to chosencourse
    end if
    if chosenslot is "G" then
    set slotG to chosencourse
    end if
    if chosenslot is "H" then
    set slotH to chosencourse
    end if
    end repeat
    set TargetCalendar to "Classes2"
    --Predefined period times
    set periodTimes to {{startTime:"08:30 AM", endTime:"09:25 AM"}, {startTime:"09:30 AM", endTime:"10:25 AM"}, {startTime:"10:30 AM", endTime:"11:25 AM"}, {startTime:"11:30 AM", endTime:"12:25 PM"}, {startTime:"12:30 PM", endTime:"01:25 PM"}, {startTime:"01:30 PM", endTime:"02:25 PM"}}
    set Day1pattern to {slotA, slotB, slotC, slotD, slotE, slotF}
    set Day2pattern to {slotG, slotH, slotA, slotD, slotE, slotB}
    set Day3pattern to {slotF, slotC, slotG, slotD, slotE, slotH}
    set Day4pattern to {slotB, slotA, slotF, slotD, slotE, slotC}
    set Day5pattern to {slotH, slotG, slotB, slotD, slotE, slotA}
    set Day6pattern to {slotC, slotF, slotH, slotD, slotE, slotG}
    --Predefined period cycles
    set Day1 to {slotA & " period 1", slotB & " period 2", slotC & " period 3", slotD & " period 4", slotE & " period 5", slotF & " Period 6 "}
    set Day2 to {slotG & " period 1", slotH & " period 2", slotA & "  period 3", slotD & " period 4", slotE & " period 5", slotB & "  period 6"}
    set Day3 to {slotF & " period 1", slotC & " period 2", slotG & " period 3", slotD & " period 4", slotE & " period 5", slotH & " period 6"}
    set Day4 to {slotB & " period 1", slotA & " period 2", slotF & " period 3", slotD & " period 4", slotE & " period 5", slotC & " period 6"}
    set Day5 to {slotH & " period 1", slotG & " period 2", slotB & " period 3", slotD & " period 4", slotE & " period 5", slotA & " period 6"}
    set Day6 to {slotC & " period 1", slotF & " period 2", slotH & " period 3", slotD & " period 4", slotE & " period 5", slotG & " period 6"}
    --Makes a "list of lists" so that all the period definitions are in one place
    set periodCycle to {Day1, Day2, Day3, Day4, Day5, Day6}
    set periodcycle2 to {Day1pattern, Day2pattern, Day3pattern, Day4pattern, Day5pattern, Day6pattern}
    set isitacycleday to {"Day 1", "Day 2", "Day 3", "Day 4", "Day 5", "Day 6"}
    --This repeat loop is using the cycle day definitions in the calendar named "School Calendar "A.Y.""
    repeat with theEvent in (events of calendar "School Calendar 09-10")
    if isitacycleday contains (summary of theEvent) then
    --Gets the current day and the cycle day number
    set cycleday to summary of theEvent
    set cycleDate to (start date of theEvent) + 1 * hours
    set cycleNumber to last character of cycleday as integer
    --There are always 6 periods in every day
    repeat with periodNumber from 1 to 6
    --Gets the subject from periodCycle
    set theSummary2 to item periodNumber of item cycleNumber of periodcycle2
    set theSummary to item periodNumber of item cycleNumber of periodCycle
    --Checks to see if there's a subject for this period, if not skips to next one
    if theSummary2 is not "" then
    set theStart to date (startTime of item periodNumber of periodTimes) of cycleDate
    set theEnd to date (endTime of item periodNumber of periodTimes) of cycleDate
    --Makes the event in the calender whose name is defined at the top of the script
    make new event at end of calendar TargetCalendar with properties {summary:theSummary, start date:theStart, end date:theEnd}
    end if
    end repeat
    end if
    end repeat
    end tell </pre>

    Did it run faster in the past?
    The events are happening as your script is generating them - for example, you get the event summary to compare in an if statement, then get it again when you assign it to a variable. The Script Editor's *Event Log* is handy in this case to see when you are creating a lot of extraneous or duplicate events.
    Also, when using application tell statements, you should only target the application's terminology, since it will just pass back what it doesn't know how to do - in other words, try not to put anything in the statement except what you need from the application.
    I don't have your iCal calendar events to play with, but a couple of tweaks to your code should improve the performance:
    <pre style="
    font-family: Monaco, 'Courier New', Courier, monospace;
    font-size: 10px;
    font-weight: normal;
    margin: 0px;
    padding: 5px;
    border: 1px solid #000000;
    width: 720px; height: 340px;
    color: #000000;
    background-color: #FFEE80;
    overflow: auto;"
    title="this text can be pasted into the Script Editor">
    ---------This is where you gather / set user data
    display dialog "How many courses do you teach?" default answer ""
    set courses to the text returned of the result as number
    set slotA to ""
    set slotB to ""
    set slotC to ""
    set slotD to ""
    set slotE to ""
    set slotF to ""
    set slotG to ""
    set slotH to ""
    repeat with x from 1 to courses
    set entered to text returned of (display dialog "Please enter the slot (A-H) and the course name, separating them with a comma:" default answer "")
    set astid to AppleScript's text item delimiters
    set AppleScript's text item delimiters to ","
    set {chosenslot, chosencourse} to {(entered's text item 1), (entered's text item 2)}
    if chosenslot is "A" then
    set slotA to chosencourse
    end if
    if chosenslot is "B" then
    set slotB to chosencourse
    end if
    if chosenslot is "C" then
    set slotC to chosencourse
    end if
    if chosenslot is "D" then
    set slotD to chosencourse
    end if
    if chosenslot is "E" then
    set slotE to chosencourse
    end if
    if chosenslot is "F" then
    set slotF to chosencourse
    end if
    if chosenslot is "G" then
    set slotG to chosencourse
    end if
    if chosenslot is "H" then
    set slotH to chosencourse
    end if
    end repeat
    set TargetCalendar to "Classes2"
    --Predefined period times
    set periodTimes to {{startTime:"08:30 AM", endTime:"09:25 AM"}, {startTime:"09:30 AM", endTime:"10:25 AM"}, {startTime:"10:30 AM", endTime:"11:25 AM"}, {startTime:"11:30 AM", endTime:"12:25 PM"}, {startTime:"12:30 PM", endTime:"01:25 PM"}, {startTime:"01:30 PM", endTime:"02:25 PM"}}
    set Day1pattern to {slotA, slotB, slotC, slotD, slotE, slotF}
    set Day2pattern to {slotG, slotH, slotA, slotD, slotE, slotB}
    set Day3pattern to {slotF, slotC, slotG, slotD, slotE, slotH}
    set Day4pattern to {slotB, slotA, slotF, slotD, slotE, slotC}
    set Day5pattern to {slotH, slotG, slotB, slotD, slotE, slotA}
    set Day6pattern to {slotC, slotF, slotH, slotD, slotE, slotG}
    --Predefined period cycles
    set Day1 to {slotA & " period 1", slotB & " period 2", slotC & " period 3", slotD & " period 4", slotE & " period 5", slotF & " Period 6 "}
    set Day2 to {slotG & " period 1", slotH & " period 2", slotA & "  period 3", slotD & " period 4", slotE & " period 5", slotB & "  period 6"}
    set Day3 to {slotF & " period 1", slotC & " period 2", slotG & " period 3", slotD & " period 4", slotE & " period 5", slotH & " period 6"}
    set Day4 to {slotB & " period 1", slotA & " period 2", slotF & " period 3", slotD & " period 4", slotE & " period 5", slotC & " period 6"}
    set Day5 to {slotH & " period 1", slotG & " period 2", slotB & " period 3", slotD & " period 4", slotE & " period 5", slotA & " period 6"}
    set Day6 to {slotC & " period 1", slotF & " period 2", slotH & " period 3", slotD & " period 4", slotE & " period 5", slotG & " period 6"}
    --Makes a "list of lists" so that all the period definitions are in one place
    set periodCycle to {Day1, Day2, Day3, Day4, Day5, Day6}
    set periodcycle2 to {Day1pattern, Day2pattern, Day3pattern, Day4pattern, Day5pattern, Day6pattern}
    set isitacycleday to {"Day 1", "Day 2", "Day 3", "Day 4", "Day 5", "Day 6"}
    --This repeat loop is using the cycle day definitions in the calendar named "School Calendar "A.Y.""
    tell application "iCal" to repeat with theEvent in (get events of calendar "School Calendar 09-10") --> only target iCal for what it knows
    set cycleday to summary of theEvent --> might as well set the info
    if cycleday is in isitacycleday then
    --Gets the current day and the cycle day number
    set cycleDate to (start date of theEvent) + 1 * hours
    set cycleNumber to last character of cycleday as integer
    --There are always 6 periods in every day
    repeat with periodNumber from 1 to 6
    --Checks to see if there's a subject for this period, if not skips to next one
    if (item periodNumber of item cycleNumber of periodcycle2) is not "" then --> skip as much as possible
    --Gets the subject from periodCycle
    set theSummary to item periodNumber of item cycleNumber of periodCycle
    set theStart to date (startTime of item periodNumber of periodTimes) of cycleDate
    set theEnd to date (endTime of item periodNumber of periodTimes) of cycleDate
    --Makes the event in the calender whose name is defined at the top of the script
    make new event at end of calendar TargetCalendar with properties {summary:theSummary, start date:theStart, end date:theEnd}
    end if
    end repeat
    end if
    end repeat
    </pre>

  • Deleting event in iCal 5.0.1 not syncing with Google Calendar

    When I delete an event from iCal, it does not sync with Google Calendar.  However, when I create an event in iCal, it syncs just fine with Google Calendar. Creating and deleting events from Google Calendar syncs fine with iCal.  Has anyone else experienced this problem?

    12/13/2011 - call to google tech support
    Recent support call with Google: iCal deleting events still broken.  this is big for us.  We have users that have accounts for and/or subscribe to multiple calendars, and took a while to teach them to use iCal, so web based calendars will be foreign to them (even though I like the web based).  There is no timeline in place according to Google Tech Support.  I feel like the issue is really Apple's issue, so Google is waiting on them to fix, this type of urgency(or lack of) is right up their alley.  Oh well.
    Does anyone have any suggestions on alternate calendar apps for Mac?  Specifically for google calendars?
    "Regarding the issue about not being able to delete Google Calendar events within iCal, as mentioned it is a known issue which unfortunately we don't have a time frame to offer you.
    You can visit  http://support.google.com/calendar/bin/static.py?hl=en&page=known_issues.cs for Google Calendar known issues.
    You can submit a feature request at https://www.google.com/moderator/#16/e=ba1ca which is also located at the bottom of your Control Panel as ‘Suggest a feature.’ "

  • Bugs with Lion! Cannot delete events in iCal and other stuff...

    First, sorry for my English, I speak French...
    I installed Lion on my MacBook Pro, my iMac and on my girlfriend's MacBook Pro and I have the same problems on each computer! Help please!
    I try to delete an event on iCal and it always comes back!! I cannot delete it and I cannot delete an entire calendar too! It disappears and 10 seconds later, it's back!
    I also removed an icon from the Dock but when I restart the computer, it is back in the dock!
    I have also some issues with the file sharing between my Macs. Usually, I entered the username and password of the Mac and it was possible to access everything from another Mac. But now it doesn't work! I think that I must create a new user account for file sharing...
    What should I do??
    Thanks!!!

    I have the same issues with items "re-appearing" in the dock after reboot or waking from sleep. I went into recovery mode, wiped my hard drive, and cleanly reinstalled lion to no avail. I had other issues that cleared up, but my dock is full of apps I never use...so I can only conclude its a bug.

  • How to delete events on iCal that were created many years ago with a MobileMe account?

    I have never ending recurring events on iCal that I created years and years ago with my MobileMe account.  I don't have access to that email anymore, unfortunately.  Is there any way to get rid of these silly things?

    Navi,
    What Calendars are listed in your sources pane?
    Where are they located?
    Are you using iCloud?
    Backup that specific calendar using Calendar>File>Export>Export..., and save the copy to your Desktop.
    What happens if you attempt to delete that specific calendar?

  • Can you preview an event in Ical, using Lion, by moving your mouse over the event?

    I have been trying to fougure out to problems in Ical, using Lion.  There does not seem to be anyway to preview an event accept by double clicing the event.  I also do not understand why there is not a drop down menu to choose the month of a new event or when you change an event.  I hope there is a way to change to a drop menu for the month, it is such a waste time to have to type the date in every time.  Any suggestions?

    The only problem is, that I can't move my mouse to the location I want. I heard you could use the Robot class for this, but it didn't work out as I wanted -I guess I screwed the code up-. So I'd like to know how I'm able to move my mouse, left click and right click, all at custom locations, given using JOptionPane. Could someone please write an easy example of all those things?Well, Robot is meant to generate mouse moves, mouse clicks, and key types, but consider this:
    - if you need this to implement a feature of an application, I find this suspicious (except if you are developing a tutorial feature such as "Help/Show me how to...").
    - if you need this to test an application, you'd better use a higher-level API, such as jfcUnit or Fest-Swing (tons of other exist), that enables you to simulate actions (and check results!) in higher-level terms, such as "click on this button" and "check this label is green" instead of "click at that position x,y", and "peek the pixel color").
    Good luck,
    J.

  • Trouble with a script that deletes event in iCal

    Used this script over the summer and it worked fine. Can't figure out the issue now, but it isn't working. Here is a few lines of the output I get and then the error I get is at the bottom. I'll post the full script at the bottom of this posting. Error # -1728??? File doesn;t exist?
    Thanks,
    dan
    get summary of item 2 of every event of calendar "Untitled"
    --> "Enviro C Lab Period 3-4"
    get summary of item 2 of every event of calendar "Untitled"
    --> "Enviro C Lab Period 3-4"
    get description of item 2 of every event of calendar "Untitled"
    --> missing value
    get status of item 2 of every event of calendar "Untitled"
    --> none
    get start date of item 2 of every event of calendar "Untitled"
    --> date "Tuesday, April 26, 2011 10:30:00 AM"
    get summary of item 2 of every event of calendar "Untitled"
    --> "Enviro C Lab Period 3-4"
    get end date of item 2 of every event of calendar "Untitled"
    --> date "Tuesday, April 26, 2011 11:55:00 AM"
    get allday event of item 2 of every event of calendar "Untitled"
    --> false
    make new event at end of every event of calendar "Untitled" with properties {status:none, start date:date "Tuesday, April 26, 2011 10:30:00 AM", summary:"Enviro C Lab Period 3-4", end date:date "Tuesday, April 26, 2011 12:25:00 PM", allday event:false}
    --> event id "AF27EFB6-3949-4977-A153-1EFE31FD8206" of calendar id "0EDA6DFD-52AD-4E7F-BC81-984CFF7D3F39"
    delete item 2 of every event of calendar "Untitled"
    --> error number -1728 from item 2 of every event of calendar "Untitled"
    Result:
    error "iCal got an error: Can’t get item 2 of every event of calendar \"Untitled\"." number -1728 from item 2 of every event of calendar "Untitled"
    <pre style="
    font-family: Monaco, 'Courier New', Courier, monospace;
    font-size: 10px;
    margin: 0px;
    padding: 5px;
    border: 1px solid #000000;
    width: 720px; height: 340px;
    color: #000000;
    background-color: #FFDDFF;
    overflow: auto;"
    title="this text can be pasted into a HTML editor">
    tell application "iCal"
    repeat with theEvent in (events of calendar "Untitled")
    set control to {}
    set control to summary of theEvent
    set AppleScript's text item delimiters to space
    set theSummary to summary of theEvent
    set textSummary to text items of theSummary
    if the third item of textSummary is "Lab" then
    if the fifth item of textSummary is "5-6" then
    get theEvent
    set theDescription to description of theEvent
    set theStatus to status of theEvent
    set theStartDate to (start date of theEvent) - 0.5 * hours
    set theSummary to summary of theEvent
    set theEndDate to end date of theEvent
    set theAllDay to allday event of theEvent
    set newEvent to (make new event at end of events of calendar "Untitled" with properties {status:theStatus, start date:theStartDate, summary:theSummary, end date:theEndDate, allday event:theAllDay})
    set oldEvent to ""
    set theEvent to oldEvent
    get theEvent
    delete theEvent
    end if
    if the fifth item of textSummary is "3-4" then
    get theEvent
    set theDescription to description of theEvent
    set theStatus to status of theEvent
    set theStartDate to start date of theEvent
    set theSummary to summary of theEvent
    set theEndDate to (end date of theEvent) + 0.5 * hours
    set theAllDay to allday event of theEvent
    set newEvent to (make new event at end of events of calendar "Untitled" with properties {status:theStatus, start date:theStartDate, summary:theSummary, end date:theEndDate, allday event:theAllDay})
    delete theEvent
    end if
    end if
    end repeat
    end tell
    </pre>

    Hello
    The posted event log indicates some inconsistent behaviour of iCal in referencing item 2 of every event. I.e., it could access it first and failed to do so after a new event is created. Scent of bug here. Or possibly inserting ugly small delay after event creation might let the script delete the newly created event...
    Anyway, the 'by index' reference form of object must be used very carefully when object can be deleted or added dynamically.
    Also I wish to add that it is not recommended to use an object specifier, that returns list of objects, as the base list for repeat statement, such as :
    --CODE1
    -- # not recommended
    repeat with theEvent of (events of calendar "Untitled")
    -- omitted
    end repeat
    --END OF CODE1
    Instead, you'd better get the list first and use it, such as :
    --CODE2
    -- # recommended
    repeat with theEvent of (get events of calendar "Untitled")
    -- omitted
    end repeat
    --END OF CODE2
    The reason is as follows.
    In CODE1, the iterator is assigned as item k of events of calendar "Untitled", where k iterates from 1 to count of events of calendar "Untitled" at the time of loop entrance. The problem is that this list of events is dynamic list which may change when event is deleted or added, and consequently item k as iterator may no longer refer to the item k of the original collection of events.
    In CODE2, the iterator is assigned as item k of a static list which is obtained by statement 'get events of calendar "Untitled" at the time of loop entrance. If the event object is returned in 'by ID' reference form (or any form other than that depends upon index in the container), item k as iterator is guaranteed to refer to the item k of the original collection of events whether or not collection changes.
    Thus you may try something like this :
    --SCRIPT
    (* not tested *)
    tell application "iCal"
    tell calendar "Untitled"
    repeat with theEvent in (get its events) -- # get the objects list
    set theEvent to theEvent's contents -- # dereference each once
    set AppleScript's text item delimiters to {space}
    set textSummary to text items of summary of theEvent
    set AppleScript's text item delimiters to {""} -- # reset astid
    if item 3 of textSummary is "Lab" then
    if item 5 of textSummary is "5-6" then
    tell theEvent
    set prop to {¬
    start date:(its start date) - 0.5 * hours, ¬
    end date:its end date, ¬
    status:its status, ¬
    summary:its summary, ¬
    allday event:its allday event}
    end tell
    make new event at end of events with properties prop
    delete theEvent
    end if
    if item 5 of textSummary is "3-4" then
    tell theEvent
    set prop to {¬
    start date:its start date, ¬
    end date:(its end date) + 0.5 * hours, ¬
    status:its status, ¬
    summary:its summary, ¬
    allday event:its allday event}
    end tell
    make new event at end of events with properties prop
    delete theEvent
    end if
    end if
    end repeat
    end tell
    end tell
    --END OF SCRIPT
    Hope this may help,
    H

  • How to delete events in ical?

    When I save an appointment in ical on my imac in the icloud section and then want to delete it, it's not possible. Anyone any tips? I have Lion installed and didn't have this problem before...

    use the following article to delete an icloud calendar event:
    http://support.apple.com/kb/PH2684
    should resolve your issue!

  • How to delete events in iCal on Mac, but not from iPhone

    Hi everyone,
    I have a reminder set to my phone for something everyday which is great because it's the first thing I look at in the morning. But I don't want this event plastered all over my iCal on my computer as it's unnecessary to see it there. But of course, since I sync my iPhone with this computer, it always ends up there too.
    Is there a way to sync only certain events, but not all of them? Sometimes I want to do the opposite, where I need to see a reminder on my computer for work, but don't need it popping up on my phone.
    Thanks for any help you can give!

    use the following article to delete an icloud calendar event:
    http://support.apple.com/kb/PH2684
    should resolve your issue!

  • Cannot delete event in ical

    I have repeated events that have gone wild in my ical. The events show up doubled on the wrong dates and I cannot click on them to delete or edit them…any virus I should know of? I am still on Leopard and have not dared messing with icloud yet either.

    Is your ical connected with any other calendars like Google's?

  • How to filter Outlook for Mac calendar events by category using AppleScript

    Hi all --
    I'm trying to write an Applescript on OSX to filter Outlook for Mac 2011 calendar events based on event categories, e.g. find all events tagged as "Conference". For example, I have a calendar event named "WWDC" that is found by the following script:
    tell application "Microsoft Outlook"
      set theCategoryConference to first category whose name is "Conference"
      set theConferenceList to every calendar event whose (subject is "WWDC")
      display dialog "There were " & (count of theConferenceList) & " Conferences."
      set theEvent to item 1 of items of theConferenceList
      display dialog "Categories contains conference: " & (categories of theEvent contains {theCategoryConference})
    end tell
    The above finds 1 event, and the final line displays "true" as this event has been tagged with the Conference category.
    However what I really want to do is find all such events. The following fails to match any events:
    set theConferenceList to every calendar event whose categories contains {theCategoryConference}
    ThIs seems to me like it should work, but returns 0 matching events. Is there a different syntax to use, or is this a limitation of Outlook for Mac that perhaps doesn't allow filtering events based on a nested collection (the categories attribute on calendar event objects)?
    Thanks!
    Ramon

    Hello
    I don't have Outlook 2011 but only guess here.
    Generally speaking, AppleScript's "whose" filter is very limited and does not support list containment test. So perhaps you'd have to resort to something like the following script, which actually scans the events for test.
    tell application "Microsoft Outlook"
        my events_with_categories({category "Conference"})
    end tell
    on events_with_categories(cats)
            list cats : list of categories to be matched
            return list : list of calendar events whose categories contain every item of cats
        script o
            property ee : {}
            property cc : {}
            tell application "Microsoft Outlook"
                set ee to calendar events
                repeat with e in my ee
                    set e to e's contents
                    set cc to e's categories
                    set _match to true
                    repeat with c in cats
                        set c to c's contents
                        if c is not in my cc then
                            set _match to false
                            exit repeat
                        end if
                    end repeat
                    if _match then set end of my ee to e
                end repeat
                return my ee's contents
            end tell
        end script
        tell o to run
    end events_with_categories
    Notes.
    * Script is not tested.
    * IF this works but is too slow, we may try to speed it up by retrieving categories of events (list of lists) in one statement, by which we can dramatically reduce the total number of Apple Events to send.
    Good luck,
    H

  • How do you delete an event in iCal?

    I have an iPad 2 and I cannot delete events from iCal.
    Does anyone know how to do this?
    iPad 2 seems very unstable after the latest software update on 9 May 2011.

    Click on the event, and use the delete key. Or click on the event, and choose iCal>Edit>Delete.
    Good luck.

  • Error while deleting events from the integration event queue

    I am trying to delete all the events from the integration event queue after reading it, like this (this is in Java):
            IntegrationEventWS_DeleteEvents_Input input = new IntegrationEventWS_DeleteEvents_Input();
            input.setDateTime("");
            input.setLastEventId("");
            try {
                 ((Default_Binding_IntegrationEventWS)onDemandStub).deleteEvents(input);
            } catch (Exception e) {
                 log.error("Deleting events from integration queue failed: ", e);
            }Alas, I get the following error message:
    Invalid method parameter(s): 'File Id'(SBL-ODS-50007)What does this mean? What is this mysterious "File Id" it supposedly gets? I don't see it anywhere in the SOAP message I'm sending and it isn't mentioned anywhere in the docs.
    Thanks in advance for any input.

    Dont keep this attributes null
    input.setDateTime(""); //Put a Default Time way in
    the past. Ex:"1/1/2000"
    input.setLastEventId(""); //pass the eventIdThe documentation states that those two are optional (although they are not nillable, for some reason). I tried to set the date to today, but I got the same result. Since setting a date is supposed to delete all events older than that date, I don't think setting it in the past will delete anything.

  • Mail not sending Event to iCal after upgrade

    I did the same as everyone else and upgraded as soon as I saw the message to upgrade mobileme ical. Now when I try to create an event in iCal using a date in an email after clicking on "Add To iCal" the popup just freezes. I've quited and rebooted Mail as well as iCal and no luck.
    Anyone else have this issue? Better yet, did anyone else find out how to fix it?
    With 4 boys I rely on that convenience big time!
    Maria

    The general approach at this time is to ask if you've checked for any problematic fonts (all languages) with Apple's Font Book (look in the Applications folder). Find and remove all duplicates also.
    Start there to be sure all fonts that are in play come out with a clean bill of health.
    Don't hesisate to perform wholesale deletion of old and/or little used fonts - be skeptical of anything that has come from Office 2008, including those related to an Equation Editor installation.
    By all means be sure any 3rd party apps AND plug-ins are Snow Leopard compatible.
    An additional measure is to clear the existing font caches:
    http://www.macworld.com/article/139383/2009/03/fontcacheclear.html
    That said, 10.6.2 release notes have this to say about fonts:
    http://support.apple.com/kb/HT3874
    Fonts fixes provided for:
    • an issue with font spacing
    • an issue in which some Fonts are missing
    • font duplication issues
    • an issue with some PostScript Type 1 fonts not working properly
    Good luck in any case.

  • Add event in iCal from Mail

    I know there is a way to do this I just dont know how. Also, I need it to be only certain emails from a couple of senders, not every email they send with a date. Is there any way this can be done? I appreciate the help

    Hello Alex,
    I've been working on trying to get .vcs files from my email into iCal using Applescript, and have written a script that I can drop the .vcs files onto which will then import them into the calendar.... Here is a link to my post in the Applescript forum regarding this...
    Tyson Brown, "Using Applescript to edit a .vcs file" #3, 12:46pm Nov 3, 2005 CDT
    I THINK this will work to get you to the post. If not, let me know and I can drop you a copy of the script. I don't think the script will suit your needs "off the shelf" but I think there would only need to be one modification to it so that it will work for you.... Right now I have it set up to import the same event into two different calendars. All that needs to happen is for me to change it so that it only imports to 1 calendar. Let me know if you are not an Applescripter, and I will see if I can whip those changes off for you....

Maybe you are looking for