Unable to run AppleScript from osascript : not authorized to send Apple Events
I have written a script that interacts with the calendar application. It works fine when run from the Script Editor, but when I try to run it from the command line using osascript, I get this error:
collect_events.scpt: execution error: Not authorized to send Apple events to Calendar. (-1743)
Unfortunately, AFAICT there is no way to fix this problem. There is no way to add Calendar to the set of applications that osascript is allowed to control:
So what should I do?
I see a number of different questions that are similar to this one in the discussions, and I don't see any solution, so does that mean this is impossible?
I thought it might be possible to work this by saving my script as an application. Indeed, this does get me an entry in the options:
but now when I run my application it pops up an access authorization dialog box like this:
...and when I click "OK," it pops up the same window again, and again, and again, and ...