tell application "iCal"
launch
set cal to "Home"
set thisCalendar to first calendar whose title is cal
set p_path to "/path/to/item"
set eventeer to (make new event at end of event of thisCalendar)
set summary of eventeer to "Title of event"
set description of eventeer to ("desctiption of event")
tell eventeer
make new open file alarm at beginning of open file alarms with properties ¬
{trigger interval:0, filepath:p_path}
set the start date to ((current date) + (60 * 5))
end tell
activate
show eventeer
end tell
by ~John “Hannible” Smith from The A-Team
cheers for that Hannible!
but i need to set the open file event to repeat every week
i,ve gone through the ical dictionary, but i can’t find any reference to the repeat function. same with UI browser.
is it possible this function is not scriptable?.
would appreciate some help.
thanks in advance.
truth.
repeat is a standard applescript statement. It can be used in conjunction with any application.
This is how I increment a date per week, up until a given date.
set maximum to (current date)
tell maximum to set {month of it, day, time} to {December, 31, 86399}
set the_date to (current date)
repeat while the_date is less than or equal to maximum
-- perform actions
display dialog short date string of the_date -- debug line
set the_date to the_date + (7 * days)
end repeat
days is an applescript constant equal to 86400 (in seconds), so a week would be 7 * days.
thanks for that Querty.
that was just what i was looking for,
had a bit of a headache trying to combine the two, but i got there in the end.
this forum rocks!!!
heres the script as it stands:
make new open file alarm in ical to repeat every 7 days:
tell application "iCal"
launch
set maximum to (current date)
tell maximum to set {month of it, day, time} to {December, 31, 86399}
set the_date to (current date)
repeat while the_date is less than or equal to maximum
set cal to "Home"
set thisCalendar to first calendar whose title is cal
set p_path to "/path/to/item"
set eventeer to (make new event at end of event of thisCalendar)
set summary of eventeer to "Title of event"
set description of eventeer to ("desctiption of event")
tell eventeer
make new open file alarm at beginning of open file alarms with properties ¬
{trigger interval:0, filepath:p_path}
set the start date to the_date
set the_date to the_date + (7 * days)
end tell
end repeat
activate
show eventeer
end tell