This script, which adds an event to the Calendar, works with the calendars that are local to the Mac that it runs on. When used with iCloud calendars, it seems that the alert is set for a few seconds after the entry is created, and then it is unset.

set alarmTime to -20

set label to "Alert"
set startDate to (current date)
set endDate to startDate + 10 * minutes

tell application "Calendar" to tell calendar "Rolf Marvin Bøe Lindgren"
    set thisEvent to make new event at end of events with properties {start date:startDate, end date:endDate, summary:label}
    make new display alarm at end of display alarms of thisEvent with properties {trigger interval:alarmTime}
end tell

Any and all hints and suggestions appreciated.

Thank you.

  • I notice a meaningful lag in the sync for the alarm that's added, but it does eventually sync. Just for kicks, I changed the delay to 1, and it was near immediate. Also, do you have a default alert time already set for that calendar? – webmarc Jul 3 '18 at 19:13
  • Whops, the "delay" shouldn't have been there, I added it to see if that would help. I didn't have a default alert time set for the calenar, but I have set one now. – roffe Jul 4 '18 at 6:57

You must log in to answer this question.

Browse other questions tagged .