Skip to content

Commit

Permalink
Fix AppleScript compatibility with macOS Ventura and older
Browse files Browse the repository at this point in the history
According to the documentation, requestFullAccessToEventsWithCompletion
only works on macOS 14.0+ (i.e. macOS Sonoma and newer).
  • Loading branch information
caleb531 committed Oct 16, 2023
1 parent ba7624f commit a904463
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion ocu/calendars/get-calendar-events.applescript
Original file line number Diff line number Diff line change
Expand Up @@ -190,7 +190,13 @@ on run(listOfCalNames)
-- Access" vs. "Add Only"); the recommended alternative is to use
-- requestFullAccessToEventsWithCompletion (documentation here:
-- <https://developer.apple.com/documentation/eventkit/ekeventstore/4162272-requestfullaccesstoeventswithcom>)
theEKEventStore's requestFullAccessToEventsWithCompletion:(missing value)
try
# macOS Sonoma and newer
theEKEventStore's requestFullAccessToEventsWithCompletion:(missing value)
on error
# macOS Ventura and older
theEKEventStore's requestAccessToEntityType:0 completion:(missing value)
end try

-- get calendars that can store events
set theCalendars to theEKEventStore's calendarsForEntityType:0
Expand Down

0 comments on commit a904463

Please sign in to comment.