tell application "Calendar"
tell calendar "Test"
set cur_date to (current date)
set cur_date to "Monday, September 2, 2013 3:15:30 PM"
make new event at end with properties {description:"Event Description", summary:"Event Name", location:"Event Location", start date:cur_date as date, filepath:"/users/temp/desktop/test.app"}
end tell
end tell
Objective:
create an event with a specific date
add an open a file alert to that event that open 0 minutes before
Issues:
specifying a date gives “Can’t make “Monday, September 2, 2013 3:15:30 PM” into type date.”
tell application "Calendar"
tell calendar "Test"
set cur_date to (current date)
set cur_date to "Monday, September 2, 2013 3:15:30 PM"
make new event at end with properties {description:"Event Description", summary:"Event Name", location:"Event Location", start date:cur_date, filepath:"/users/temp/desktop/test.app"}
end tell
end tell
You didn’t do what I said. That’s why you ended up with the full date. When you compile the script it changes your short dates to full dates. That’s why I put the string date into a variable. I’m thinking about later on also.
Hi. The filepath belongs to the alarm, not the event. Additionally, it might be nice to use something other than “cur_date” as a variable for a date that isn’t the current date.
set alarmDate to date "Monday, September 2, 2013 3:15:30 PM"
tell application "Calendar" to tell calendar "Test" to tell (make event with properties {summary:"Whatever", start date:alarmDate})
make open file alarm with properties {trigger date:alarmDate, filepath:(((path to desktop) as text) & "test.app")'s POSIX path}
end tell