• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Determining the default CalendarName in Calendar
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Determining the default CalendarName in Calendar


  • Subject: Re: Determining the default CalendarName in Calendar
  • From: Shane Stanley <email@hidden>
  • Date: Mon, 18 May 2015 10:46:25 +1000

On 17 May 2015, at 10:32 pm, Nigel Garvey <email@hidden> wrote:

This seems to work:

And another option, not requiring Calendar to be running (but requiring 10.9+):

use framework "Foundation"
use framework "EventKit"

-- create event store and get the OK to access Calendars
set theEKEventStore to current application's EKEventStore's alloc()'s init()
theEKEventStore's requestAccessToEntityType:0 completion:(missing value)

-- check if app has access; this will still occur the first time you OK authorization
set authorizationStatus to current application's EKEventStore's authorizationStatusForEntityType:0 -- work around enum bug
if authorizationStatus is not 3 then
display dialog "Access must be given in System Preferences" & linefeed & "-> Security & Privacy first." buttons {"OK"} default button 1
tell application "System Preferences"
activate
tell pane id "com.apple.preference.security" to reveal anchor "Privacy"
end tell
error number -128
end if

-- get calendars that can store events
set theName to theEKEventStore's defaultCalendarForNewEvents()'s title() as text


-- 
Shane Stanley <email@hidden>
<www.macosxautomation.com/applescript/apps/>

 _______________________________________________
Do not post admin requests to the list. They will be ignored.
AppleScript-Users mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
Archives: http://lists.apple.com/archives/applescript-users

This email sent to email@hidden

  • Follow-Ups:
    • Re: Determining the default CalendarName in Calendar
      • From: Bill Vlahos <email@hidden>
    • Re: Determining the default CalendarName in Calendar
      • From: Yvan KOENIG <email@hidden>
References: 
 >Re: Determining the default CalendarName in Calendar (From: Nigel Garvey <email@hidden>)

  • Prev by Date: Re: Why isn't the Apply Images command in PhotoShop accessible to AppleScript?
  • Next by Date: Re: Determining the default CalendarName in Calendar
  • Previous by thread: Re: Determining the default CalendarName in Calendar
  • Next by thread: Re: Determining the default CalendarName in Calendar
  • Index(es):
    • Date
    • Thread