Creating a Calendar
Use the make command to create a new calendar on your Mac, as demonstrated in Listing 3-1 and Listing 3-2. The result of the make command is a reference to the newly created calendar, which can be assigned to a variable for later use in a script. For example, after you create a calendar, a script could add events to it.
APPLESCRIPT
tell application "Calendar"set theCalendarName to "Project Calendar"set theCalendarDescription to "Calendar for top secret Apple project."set theNewCalendar to make new calendar with properties {name:theCalendarName, description:theCalendarDescription}end tell--> Result: calendar 3 of application "Calendar"
JAVASCRIPT
var Calendar = Application("Calendar")var calendarName = "Project Calendar"var calendarDescription = "Calendar for top secret Apple project."var newCalendar = Calendar.Calendar({name: calendarName, description: calendarDescription}).make()// Result: Application("Calendar").calendars.at(3)
Copyright © 2018 Apple Inc. All rights reserved. Terms of Use | Privacy Policy | Updated: 2016-09-13
