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
I have 2 iphones using th same itunes account(worked for a years so dont see why I should change this ) now both uprgraded to io 6 one is 4s, the other 4.  Since upgraade, If I send a message to hubby on the 4 phone it bounces back to me and says it [More]
Dear Apple support, how can i delete my itunes account as i think im being hacked!! over the past few months a lot of money seems to be taken from my account ranging from as little as £1 to £60... i cant take any more. Can i delete the account? Can u [More]
hello - i'm exporting clips i've editing in iMovie '09 as m4v's and converting them into flv's in adobe's media encoder (from a trial download of premier pro CS5) soasto embed them in a pdf... - my frustrating problem is that some of the flv's [that [More]
Hi, I have created a certificate signing request file with keytool. When I try to create a certificate from it with CertReq (I use a Microsoft CA) I get the following error message: Certificate not issued (Denied) Denied by Policy Module The request [More]
Yeah, I'm a dummy. I dropped my Treo650 on the data connector. I noticed some of the fins separating the "pins" on the connector kind messed up so I straightened them out as best as possible. The sync cable looks like it makes a good connection, [More]
Hi, We had just activated business function LOG_EAM_ROTSUB and LOG_EAM_ROTSUB_2 in our system. This gives us flexibility in handling special stocks and among other allows us to use mvtyp 313 with special stock. Referring to SAP Help page here it is p [More]
I am running an application with a FileBrowser as part of it. I have built it in JBuilderX and it runs fine with that IDE. I am now running it as a jar from the command line and am getting an error window appearing as the FileBrowser checks the direc [More]
Is there a SAP standard way of XML schema that we exchange between SAP and other system? Please let me know. Thanks.See SAP Interface Repository (http://ifr.sap.com). My proposal is to leave old SAP connectors staff and use SAP Exchange Infrastructur [More]
Hi, I would like to know the effect of of price of control in purcahse order.  In contract, the price date control is set as "blank"; i.e., no control.  Now what effect will it have if a price is changed in contract.  If i update the price in PO [More]
I just got an the new ipod touch and it won't recognize my password, Any suggestions?Does the iPod connect to other networks? Do other devices now connect? Try: - Reset the iOS device. Nothing will be lost Reset iOS device: Hold down the On/Off butto [More]