Finding a Calendar
You can locate a calendar by searching for its name, as demonstrated in Listing 4-1 and Listing 4-2. The result of each example is a reference to the found calendar, which has been assigned to a variable for potential use later in a script.
APPLESCRIPT
tell application "Calendar"
set theCalendarName to "Project Calendar"
set theCalendar to first calendar where its name = theCalendarName
end tell
--> Result: calendar id "80CCA5CA-808B-43B3-936D-4D9D7B33B516" of application "Calendar"
JAVASCRIPT
var Calendar = Application("Calendar")
var calendarName = "Project Calendar"
Calendar.calendars.whose({name: "Project Calendar"})
// Result: Application("Calendar").calendars.whose({_match: [ObjectSpecifier().name, "Project Calendar"]})
Copyright © 2018 Apple Inc. All rights reserved. Terms of Use | Privacy Policy | Updated: 2016-09-13