CalendarLib EC has been updated to version 1.1.5 to work around a bug in EventKit under Big Sur when running on Apple silicon Macs. You can get it here:
Anyone else’s CalendarLibEC-based scripts stopped working in Ventura? I get the error “error “*** -[__NSPlaceholderArray initWithObjects:count:]: attempt to insert nil object from objects[0]” number -10000” with every script that calls on CalendarLib
Hi Shane,
This has worked brilliantly when called from Filemaker on macOS Monterey but I recently upgraded a user to Ventura and since then we have had random occasions where an “Unknown error -2700” has been thrown followed by “Calendar not set”.
All calendars are iCloud calendars from separate iCloud accounts, and the error seems to go when we switch the calendar to be set, call the AppleScript, then switch back to the original calendar and call again. There is no consistency in the error - seems to work fine for 99% of calls, but then randomly we get this.
This is the AppleScript that is calculated and sent from Filemaker:
use script “CalendarLib EC” version “1.1.5”
use scripting additions
set d1 to date “Wednesday, 22 November 2023 at 9:00:00”
set d2 to date “Wednesday, 22 November 2023 at 10:0:00”
set theStore to fetch store
set theCal to fetch calendar “Chris” cal type cal cloud event store theStore
set theEvent to create event event store theStore destination calendar theCal event summary “Mr Cxxx Mxxxxxx” starting date d1 ending date d2 event location “1 Rxxxxxx Road
Fxxxx
GUxx xxx” event description “Carry out boiler service” without runs all day
store event event theEvent event store theStore
set theUID to event identifier for event theEvent
tell application “Filemaker Pro”
set cell “Calendar Event UID” of current record to theUID
end tell
The only thing that has changed since before the error is the macOS. Am thinking of moving them on to Sonoma to see if the problem goes away but am concerned for compatibility as this is a business system. A second user remains on Monterey while we troubleshoot this problem. Both users are on Mac Mini M1 and using Filemaker 19. Each system is fully patched with its latest release.
Any insight would be greatly appreciated. Thanks in anticipation!
Daren.
The only thing I can suggest is that you could keep the references to the two calendars in separate variables, so you don’t call fetch calendar
repeatedly.
Hi Shane,
Thanks for your swift reply.
Not sure I understand though as fetch calendar is only used once each time the script is called.
Feels like a bug in the OS.
Daren.
It could be a bug, but it’s probably more just a subtle change in behavior. The method this library calls is asynchronous – the method returns before any work has necessarily been completed. In practice, that has generally not been a problem – but there’s no guarantee. It may be that changing calendars is forcing some minor delay – or it may be something else altogether.
The problem is that there’s no alternative, and the method involved was deprecated in macOS 10.14 anyway.
All I can sugguest is perhaps try a repeat loop, calling fetch calendar
repeatedly if it fails.
Hmm. So this will probably break soon anyway, and I’ll have to resort to expensive plugins to do this.
Not your fault of course! Thanks for taking the time to reply and for the great work you have done.
Daren.
Not necessarily. Deprecation can be done for several different reasons, and there’s lots of long-deprecated code that still works fine. Heck, AppleScript support has been officially deprecated.