2

I'm confused about what's going wrong here.

I have this code

let Calendar = Application('Calendar');
console.log('Here #1');
console.log(Calendar.calendars.length);
console.log('Here #2');

If I run it in ScriptEditor the code works fine. I get this, expected, output.

/* Here #1 */
/* 17 */
/* Here #2 */

But if I run the code using osascript it doesn't give me the expected output.

(0)~/<3>Documents>osascript -l JavaScript TestCalendar.scpt 
Here #1
TestCalendar.scpt: execution error: Error: Error: An error occurred. (-1743)

System I am running on:

  • MacBook Air
  • Chip Apple M2
  • MacOS Sequoia 15.1
1
  • 1
    What happens if you open the security preferences and let your terminal app send AppleScript events to other apps? (Calendar in this case is the destination, but you need to allow the sender permissions, no? We’ve got quite a few posts covering error -1743
    – bmike
    Commented Nov 4 at 20:42

1 Answer 1

2

Error -1743 is a permissions issue (errAEEventNotPermitted). In the System Settings, Privacy & Security for Calendars may also need to be enabled.

The Privacy & Security permissions for scripts are usually some combination of Accessibility, Files and Folders, and Full Disk Access, but in addition to those, there are a few applications such as Calendar that have their own access settings.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .