On Sep 6, 2013, at 2:56 PM, Alex Hall wrote: Incidentally, if anyone has a solution for the repeating events problem, I'd love to hear it. I suppose you could iterate over every event, scanning for repetition and manually extracting if the event will repeat within your targeted timeframe, but there has to be an easier way... Please tell me there's an easier way! :)
Hi Alex,
In AppleScript, the 'recurrence' property of an 'event' is either a string or 'missing value'. When a 'recurrence' is a string, then iCal calculates future occurrences of the event from rules specified within the string. For us scripters, attempting to correctly parse future repetitions from these rules would be difficult and fraught with obstacles.
I believe that iCal generally follows the "iCalendar" standard defined by the IETF (Internet Engineering Task Force) as RFC 2445, titled "Internet Calendaring and Scheduling Core Object Specification". Using RFC 2445, for example, the string "FREQ=DAILY,BYMONTHDAY=13,BYDAY=FR" specifies every future instance of Friday the 13th. (There's one next week!) Via its UI, iCal would disallow such a complex (and contradictory) rule. And I'm not sure whether such a rule, inserted into an event via AppleScript, would actually function in iCal.
FWIW, there's an open-source Java library for parsing recurring events that use the RFC 2445 standard. It is hosted here: You might be able to make Java calls from AppleScript to utilize this library.
There may be other resources out there of which I'm unaware. Maybe Cocoa has some functionality in this department. It's too bad that Apple, who has a solution working for iCal's UI, couldn't (or didn't) expose the same in iCal's AppleScript dictionary.
Regards, Stan C.
|