@ShaneStanley, do you have an update to this script that will get the last event selected in the Apple Calendar app?
Running Calendar 11.0 (2245.5.2) on macOS 10.14.6 (Mojave).
I entered one new event, ran the script, and it worked fine.
I added two more events, one recurring, one normal, but the script still finds only the first event I entered. I tried restarting both Calendar and SD, but to no avail.
Thanks.
(*
REF: The following were used in some way in the writing of this script.
1. 2017-07-30 02:12, Shane Stanley, MacScripter
calendar selection
https://macscripter.net/viewtopic.php?pid=191043#p191043
*)
use AppleScript version "2.4" -- Yosemite (10.10) or later
use framework "Foundation"
use framework "EventKit"
use script "CalendarLib EC" version "1.1.4"
use scripting additions
set selectedID to (((current application's NSUserDefaults's alloc()'s initWithSuiteName:"com.apple.ical")'s objectForKey:"SelectedEvents")'s objectForKey:"iCal")'s firstObject()
if selectedID = missing value then error "No selection found"
set theEKEventStore to fetch store
set theEvent to theEKEventStore's eventWithIdentifier:selectedID
### This is NOT Getting the LAST Event Selected ###
set theEventID to theEvent's calendarItemExternalIdentifier() as text
set theCalID to theEvent's calendar()'s calendarIdentifier() as text
tell application id "com.apple.iCal" -- Calendar
set oEvent to event id theEventID of calendar id theCalID
set eventDesc to description of oEvent
end tell
return eventDesc