And this script creates a new event. It requires 10.11 because it relies on the new bridging of dates to NSDates, but you could add handlers to do that and run it from earlier versions. It uses Calendar.app to get a calendar uid because I'm being lazy, and the handler returns the external uid of the resulting event.
use AppleScript version "2.5"
use scripting additions
use framework "Foundation"
use framework "EventKit"
-- lazy way to specify calender
tell application "Calendar"
set calId to uid of calendar 1 whose name is "Work"
end tell
set timeNow to current date
set timeInAnHour to timeNow + 3600
set eventId to my createEventStartingAt:timeNow endingAt:timeInAnHour allDay:false theSummary:"Test event" calendarID:calId inLocation:"Backyard" withDescription:"Some notes here"
on createEventStartingAt:startDate endingAt:endDate allDay:allDayFlag theSummary:theTitle calendarID:calId inLocation:theLocation withDescription:theNotes
-- 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
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 calendar
set theCal to theEKEventStore's calendarWithIdentifier:calId
-- make new event
set newEvent to current application's EKEvent's eventWithEventStore:theEKEventStore
newEvent's setTitle:theTitle
newEvent's setAllDay:allDayFlag
newEvent's setLocation:theLocation
newEvent's setNotes:theNotes
newEvent's setStartDate:startDate
newEvent's setEndDate:endDate
newEvent's setCalendar:theCal
-- save event
set {theResult, theError} to theEKEventStore's saveEvent:newEvent span:0 commit:true |error|:(reference)
if not theResult as boolean then error (theError's localizedDescription() as text)
-- return the Calendar.app AS id
return newEvent's calendarItemExternalIdentifier() as string
end createEventStartingAt:endingAt:allDay:theSummary:calendarID:inLocation:withDescription:
I don't have any huge calendars to try it on, but in my simple ones the bit that gets the uid from Calendars.app takes about the same time as the rest.
Obviously some people have different requirements, like adding attendees, alarms, etc. But it's all do-able. If someone had a bit of time and enthusiasm, they could work up a scripting library to largely, if not completely, replace the need to script Calendar.app.