Running "CalendarLib EC" from Livecode: problem with the store

I am a Livecode developer and I am trying to use Shane’s excellent library from inside Livecode.
There seems to be a problem with the event store reference.

In Livecode, I put an applescript into a variable and then run it (do tVar as “Applescript”).
Works fine, for example, with this:
(reload an open or close calendar and update events)

try
tell application "Calendar" to activate
tell application "System Events"
tell process "Calendar"
keystroke "r" using {command down, shift down}
end tell
end tell
on error errorMsg
return ("AsReload Applescript error: " & errorMsg) as text
end try

But running any CalendarLib EC function return “execution error”, like this basic one:

use script "CalendarLib EC" version "1.1.3" -- put this at the top of your scripts
use scripting additions
set theStore to fetch store

The security prefs are fine for Livecode. The above, like any other CalendarLib EC functions, run fine from Script Debugger.

Any clues?
Thanks

Trevix

It’s hard to say. The first thing to try would be to run the lib’s code directly:

use AppleScript version "2.5" -- requires OS X 10.11 or higher
use scripting additions
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
    display dialog (authorizationStatus as text)

That will tell you whether you got access. If necessary, add some try blocks to see where the problem is happening.

Solved.
Livecode 8.1.10 had a bug that Livecode 9 does not.
Sigh.

I spoke too early.
Strange enough this works:

use script "CalendarLib EC" version "1.1.3" -- put this at the top of your scripts
use scripting additions
set theStore to fetch store
set theEvents to fetch events by UID "5DF8CB57-87AF-49F8-8F42-E6AE245C9DA9" event store theStore
try
remove event event item 1 of theEvents event store theStore with future events
on error theErr
return "NotFound"
end try

but this, as you wrote, does not:

use AppleScript version "2.5" -- requires OS X 10.11 or higher
use scripting additions
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
    display dialog (authorizationStatus as text)

It returns execution error.

The culprit could be the “current application” ?
This return “current application” (sigh):

use AppleScript version"2.5" *-- requires OS X 10.11 or higher*
use scripting additions
use framework "Foundation"
use framework "EventKit"
return current application

while it should return the path to the current app, as in Script Debugger

I’d be surprised if it is. Not that I can suggest any other culprit.