Documentation Archive

Developer

Calendar Scripting Guide

Subscribing to a Calendar

You can use the GetURL command to subscribe to a remote calendar with a specified URL, as shown in Listing 5-1 and Listing 5-2.

APPLESCRIPT

Open in Script Editor

Listing 5-1AppleScript: Subscribing to a calendar URL
  1. tell application "Calendar"
  2. GetURL "webcal://files.apple.com/calendars/US32Holidays.ics"
  3. end tell

JAVASCRIPT

Open in Script Editor

Listing 5-2JavaScript: Subscribing to a calendar URL
  1. var Calendar = Application("Calendar")
  2. Calendar.geturl("webcal://files.apple.com/calendars/US32Holidays.ics")

Unlike some of Calendar app’s other commands, the GetURL command doesn’t produce a result. It also causes Calendar to display a confirmation dialog, which must be manually accepted by the user before the subscription is complete. See Figure 5-1.

Figure 5-1Calendar URL subscription confirmation image: ../Art/calendar_subscription_2x.png