Documentation Archive

Developer

Calendar Scripting Guide

Revealing an Event

Use the show command to bring Calendar to the front and show a specified event, as demonstrated in Listing 10-1 and Listing 10-2.

APPLESCRIPT

Open in Script Editor

Listing 10-1AppleScript: Revealing an event
  1. tell application "Calendar"
  2. tell calendar "Project Calendar"
  3. show (first event where its summary = "Important Meeting!")
  4. end tell
  5. end tell

JAVASCRIPT

Open in Script Editor

Listing 10-2JavaScript: Revealing an event
  1. var app = Application.currentApplication()
  2. var Calendar = Application("Calendar")
  3. var projectCalendars = Calendar.calendars.whose({name: "Project Calendar"})
  4. var projectCalendar = projectCalendars[0]
  5. var events = projectCalendar.events.whose({summary: "Important Meeting!"})
  6. var event = events[0]
  7. event.show()