Re: Searching events in iCal
Re: Searching events in iCal
- Subject: Re: Searching events in iCal
- From: Michelle Steiner <email@hidden>
- Date: Sun, 23 Dec 2007 00:02:03 -0700
On Dec 22, 2007, at 11:33 PM, Louis Klieger wrote: Hi! Ok, I am really new at this, so please be patient with me.
I am looking to write a script that does the following:
1. Searches iCal for events with xxxxxx in the title (summary, perhaps?) 2. Sets those events to be in the XYZ calendar.
So, it would search iCal for "Doctor", and then change that event to be on the "Doctors" calendar.
I thought it would be relatively simple, but I can't seem to do it.
So if you have any insight as to base scripts to work from, phrases that may come in handy, etc., I would really appreciate it!
It took me a bit to figure it out, but this works:
tell application "iCal" move ((events of calendar "home") whose summary is "test") to after events of calendar "work" end tell
There's one problem with that script, though; it moves a random (or at least a seemingly random) number of events, from one to all, that meet the criterion. Running it again moves more of them. Also, if there are no events that meet the criterion, it does not error. So to work around that anomaly, I put it in a loop:
tell application "iCal" repeat while (count of ((events of calendar "home") whose summary is "test")) is greater than 0 move ((events of calendar "home") whose summary is "test") to after events of calendar "work" end repeat end tell
-- Michelle
-- "Cut the red wire (clip) (turn page) but first...." |
_______________________________________________
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