Sitemap

Amicuk Programming Answers

Error deleting events in iCal using applescript

2015-10-11   Views:4

Advertisement

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

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

The replay answer
Advertisement
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

Go to See the other 3 answers

Error deleting events in iCal using applescript

Category:DefaultRelease time:2015-10-11Views:130

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[More]

Deleting event in iCal 5.0.1 not syncing with Google Calendar

Category:DefaultRelease time:2015-10-11Views:130

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 exper[More]

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

Category:DefaultRelease time:2015-10-11Views:130

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 ca[More]

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

Category:DefaultRelease time:-0001-11-30Views:130

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[More]

Trouble with a script that deletes event in iCal

Category:DefaultRelease time:2015-10-11Views:130

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. Err[More]

How to delete events in ical?

Category:DefaultRelease time:2015-10-11Views:130

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 eve[More]

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

Category:DefaultRelease time:2015-10-11Views:130

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[More]

Cannot delete event in ical

Category:DefaultRelease time:2015-10-11Views:130

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[More]

How do you delete an event in iCal?

Category:DefaultRelease time:2015-10-11Views:130

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>[More]

Error while deleting events from the integration event queue

Category:DefaultRelease time:2015-10-11Views:130

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("")[More]

Delete events without notifying

Category:DefaultRelease time:-0001-11-30Views:130

Is there any way to delete events in iCal without notifying recipients? I not only get duplicate calendar items sometimes, but spam messages with ical events. Do I really need to notify spammers that they've got a valid email address? It's either tha[More]

Hot
Hi, i want to change the backgroup color of a particular row in a JTable, How can i do it?? i tried so far table.setDefaultRenderer(Integer.class,new DefaultTableCellRenderer(){         private Color color1 = new Color(255,255,204);         private C [More]
step by step creation of sales order in oopsHey Vijay Duvvada, I hope you are already referred below sap note  and which explains scope & how to do   - 1084315 - Consulting: Information about the multiple backend scenario 1763516 - How-to: Basic Setu [More]
We run two EDD Plans with very similar options, but with different plan horizons. To have the suggestions synchronized, we need to copy the "Firm Planned Orders" from one plan to another. We tried inserting the records in MSC_ST_SUPPLIES with Or [More]
After updating to Mavericks and Numbers 3.0 I can't open Numbers documents that were saved to the computer previous to the update. I get an error that says it can't be opened because it is from an unidentified developer.Hi Hans, I can get a reference [More]
I used SoundtrackPro to create an enhanced podcast. I shows up in iTunes as one long track (with chapters and graphics embedded) pretty much how I intended it show. However 1) I'm not sure how to access the url links that I embedded in it as well (I [More]
Creative Cloud shows I had installed it previously... Why isn't it allowing re-install?See if this page helps: Acrobat shows "Installed" in Adobe Application Manager when uninstalledRead other 3 answers [More]
I had to install Adobe Reader to be able to view a document a while back. For some reason it wouldn't open in Preview. Unfortunately, when I installed it Adobe Reader became the default PDF application. How do I go back to making the Preview the defa [More]
It has been properly deactivated from my Mac. I bought it in 2009 and have just upgraded to CS6. ThanksRichardnwhite wrote: It has been properly deactivated from my Mac. I bought it in 2009 and have just upgraded to CS6. All depends on how you upgrad [More]
Why I can't update my FCE to 4.0.1. I bought version 4.0. I have a lot of trouble to "Read an transfert" AVCHD files from Canon HFS 100. "No data" message. And the file is readable on the control window... Somebody have a solution... ? [More]
Hi, I had installed Sun ONE Portal Server 6.1 boudled with yahoo provider with following source: http://wwws.sun.com/software/download/products/3f566821.html Then I launch the Sun ONE Identity Server console to manage my portal, choose "Service Confi [More]