ical with repeat and end options!

Hi guys,

I got a lot of help from you guys! Thank you. I do need more help. I need to be able to automate so that I can generate all possible combination of repeating events. If i can get a head start with a one repeat option, I should be able get the other ones.

For example:

for a new event, I want to be able to set:

Repeat: Every Day
End: After 1 time

and so on. I really hope that there is a simple script that I am not aware of. Below is a partial code I have where I create a simple event with no repeat option. I would like to be able to add any type of repeat option to this event :slight_smile:

I will be waiting patiently for any reply!


tell calendar calendar_name
		set event_1 to make new event at end with properties {description:"Event Note " & indexing, summary:"Event Title " & indexing, location:" Location " & indexing, start date:start_time, end date:end_time + duration * minutes, url:"www.blackberry.com"}
		tell event_1
			make new display alarm at beginning of display alarms with properties {trigger interval:-30}


Thanks,

Riz

Hi, Riz.

An event’s repeat pattern is set via its ‘recurrence’ property, which is a text value in the form of an iCalendar (RFC2445) recurrence rule. So for an event to repeat every day, you need to set a ‘recurrence’ value of “FREQ=DAILY;INTERVAL=1”. For a fortnightly repeat ending after three iterations: “FREQ=WEEKLY;INTERVAL=2;COUNT=3”.

You need to get hold of a copy of the iCalendar (RFC2445) standard (this link’s not working as I write, but Googling “RFC2445” will turn up loads more) and learn section 4.3.10. iCal conforms to the iCalendar standard, but doesn’t implement recurrence intervals of less than a day or (in versions 1.5.5. and 2.0.5) the “SETPOS” subrule. It does observe some recurrence types that are allowed by the standard but which can’t be implemented through its GUI!

If I remember correctly, you can’t set a ‘recurrence’ value while creating the event (ie. with ‘. with properties .’). You have to create the event and then set its ‘recurrence’.

Thanks again Nigel

I have just tested it with your information and it is working PERFECTLY!

I can play around with different combination now and I was able get what i need (so far)

Thanks for taking your time to reply to my questions!

Hi Nigel Garvey,

I reviewed some of your posts (Getting the next recurrence of an iCal event II - now III!) about recurring events. It seems pretty intense coding (even for applescript) to deal with recurring events.

I wanted to find out if there is any ‘easy way’ to do what what i want to do:

  1. Given that I know exactly when (start/end date) of my recurring event is.
  2. I want to be able to edit one of the instance (example 3rd instance) and change the start time and location of that event
  3. I then want to extract information for that modified instance

I do have iCal 4.0, but I don’t have to worry about moving from Mac to Mac.

I know your local time is almost 9PM, but hoping you will be able to get back to me with some good news by tomorrow.

:slight_smile:

Thanks,

Riz

Hi, Riz.

It was also the end of a very long day where the elderly relative for whom I’m caring had needed attention three times during the previous night!

The script in “Getting the next recurrence of an iCal event II - now III!” is long and complex in order to be able to identify the next occurrence of a recurring event, given the many recurrence variations and time zones that iCal observes. Much of the necessary information can’t be got through iCal’s scripting implementation, but only through parsing its calendar files. The file-parsing code needs to be modified to work with iCal 4.0, which stores events in a different location and in a different way from the two versions on which I tested it.

Identifying the expected time of a numbered instance of a straightforward recurrence (daily, weekly, monthly, or yearly, with no specific days or months) should be comparatively simple.

If the instance has already been modified, it’ll be a detached event and there’ll be a separate file for it which is easy to find with iCal 4.0. Detached events have the same UID as their associated recurring events and contain information about when they’re due (or were originally due) in the recurrence sequence and how they differ from the main event. The file for the main event appears to be modified too.

If the instance hasn’t already been modified, there’ll be no separate information for it and its occurrence in the calendar is calculated on-the-fly by iCal.

Presumably, it would be possible to modify a recurrence instance by creating and/or editing the appropriate event files, but it would take some time to do the necessary research into what was needed and whether or not it actually worked when it was done.

A compromise, which could be done through iCal’s AppleScript implementation, would be to cancel the particular recurrence instance and replace it with an entirely new event. The disadvantage of this would be that the new event would be completely unconnected with the recurring event and any subsequent changes to the latter would not affect it.

It’s an interesting problem that I’d like to look into, but I’m afraid I can’t currently take it on as a rush job ” certainly not by the time you wake up! :frowning:

Hi Nigel,

Hope your day went smoothly. I really appreciate all your help. I don’t have much knowledge with applescript with iCal and just scratched the crust.

I didn’t know that ics files are created in that way. After you explained, I looked into it more and found out that ics files are there as you explained. However, editing them directly does not update the calendar event. If there was any way we can get access to the Sync Service with applescript that would have been easier (mayBE!).

“A compromise, which could be done through iCal’s AppleScript implementation, would be to cancel the particular recurrence instance and replace it with an entirely new event. The disadvantage of this would be that the new event would be completely unconnected with the recurring event and any subsequent changes to the latter would not affect it.”

The task that I am trying to automate requires me that I do not modify the original instance (ie. I should not delete and re-create a new sequence). I am trying to automate some testing which would check before and after I perform a sync with an external device and ensure that nothing in my iCal has been modified after transferring the data to the device.

For manual inspection, I have been using a tool called “Syncrospector”. If you select “Truth” and search for “Record and properties” from the search field using UID, it will give you a detailed information about “detached” event and “main” event information.

However, I would still not be able to edit a single instance from the recurring event. I can also do combination of UI based edit option (I use “UI Browser” to get the basic information), for example if I can get … say the 3rd instance of recurring event to display/show event information then I can easily edit that single instance and apply the changes to only that instance when the iCal prompt comes up.

I hope I did not confuse you with all my thoughts. I have a 'HUGE" list of combination of patter of recurring event that I need to test and ensure that modifying a single instance doesn’t break down everything :slight_smile:

Once again, thank you for all your time and all the help you have provided till now!

Riz