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