I am a seasoned developer, but very new to AppleScript.
I would like to change some of the details of an event in a calendar.
I have found the Library in the Script Editor, and made my way to the Calendar section. I’m not at all sure where to go from here.
In particular, I would like to change a detail which is not listed in the Library, so I’m not altogether optimistic. That detail is the time zone, in particular for the start and finish times. This information is in the ical
vevent
data which is in the raw data.
So far I am still experimenting with reading what is there:
set calendarName to "Work Travel"
set now to date "Wednesday, 1 March 2017 at 12:00:00 am"
tell application "Calendar" to tell calendar calendarName
set currentEvents to get every event where its start date ≥ now
repeat with e in currentEvents
set start to start date of e
end repeat
end tell
My current system is MacOS 10.12 Sierra.
Best Answer
Shane Stanley has a library that allows you to modify the time zone: https://www.macosxautomation.com/applescript/apps/Script_Libs.html
Update to my original reply:
In fact, your question prompted me to use the library and I found a bug in the time zone modification code, which is fixed now.
To create (or modify) an event you don't need Calendar. Just use this library.
The code here is almost 100% from the examples, I just added the line about the time zone modification:
You can find the available time zones this way:
The discussion itself is here: https://lists.apple.com/archives/applescript-users/2017/Dec/msg00006.html