iCal Applescript Project

I apologize in that I’m a very novice scripter and many of my questions could be easy.

I’m trying to write an Applescript for iCal that will create events between all of the events in a week. I.E. I have to be at work from 9 to 5, but only have appointments at noon and 3, so my work day looks mostly blank. I’d like to be able to automatically place “Discretionary time” between/around these events.

The main problem that I’m having is the date data type. How to I format a date that iCal will accept that includes a time? Should it be formated as a date or a string?

Thanks for the help. I will likely have other question after I get over this hurdle, but I’m trying to do most of it myself.

-Casey Koons

iCal’s applescript dictionary lays out the expected data type/format.

iCal is expecting an applescript date like this:

You can pretty easily make up dates and times that will fit the desired format. You just set a variable to the current time, and change the values to whatever you want:

set a to (current date)

set a's time to (19 * hours) + (25 * minutes)
set a's month to 12
set a's day to 25
set a's year to 2010
a

-->date "Saturday, December 25, 2010 7:25:00 PM"