Mojave beta 6 breaks Applescripts

Since updating to beta 6 a numebr of Applescripts fail.

Error message is 'Not authorised to send Apple events to Microsoft Outlook. (-1743)' - helpfu;ly error -1743 is not lsited in teh Applescript documentation.

Cant find a way to authjorise this - a mjor limnitation to m,y workflow!


Any ideas???

Post not yet marked as solved Up vote post of JMaynard Down vote post of JMaynard
21k views

Answers

That is errAEEventNotPermitted from the Apple Events framework - check your accessibiity permissions in System Preferences. Note that if this is an application, it should be code-signed or otherwise read-only, as scripts modify themselves for persistent properties.

Can't find anything in Accessibility permissions that impacts AppleScript.

The error message includes an 'Edit' button which opens the AppleScrpt editor - clicking run here executes the script as designed...


Strikes me as a bug since this could disable millions of AppleScript routines users have written to automate multiple taska (as I have done)

tested + confirmed! for me it's definitly a bug as well!

Post not yet marked as solved Up vote reply of Jooo Down vote reply of Jooo

If your script is being run as an application, then the application should be added to the accessibility list, but in addition, if it is accessing one of the other applications listed in the Privacy tab (e.g. Contacts), then it would need to be enabled in that list as well. The Script Editor is treated as any other application, so if your script runs from there the Script Editor application would have to be listed/enabled in the accessibility list. If your application is in the accessibility list but runs only once, that would indicate that the script is being allowed to modify itself.

Yes – definitely a change in behaviour with DP6.


Application bundles exported from Script Editor (both signed and unsigned) generate the "Not authorised to send Apple events..." errors if they contain a "tell application 'Finder'..." (or similar) block. I suspect this revolves around the new user data protections coming in Mojave (See WWDC session 702: "Your Apps and the Future of macOS Security".)


Using the "tccutil reset AppleEvents" and "tccutil reset All" commands don't appear to help.


I guess these sorts of app bundles might also need "com.apple.security.scripting-targets" Sandbox entitlements eventually.

did you add your app into accessability?

Yes – no change in behaviour – the same error gets thrown.


Logged in Bug Reporter as issue: 43047400 "Applications exported from Script Editor generate "Not authorised to send Apple events..." errors".

my workaround is, to copy&paste my script into an Xcode-Project and compile it as a Mac-App. On first Launch i must give accessibility permissions. The new App is now in my startup objects and worked fine.

OK, thanks for the feedback; added script to Privacy/Accessibility and it is already listed in the relevant privacy app (Reminders) - same issue - app fails with same error messge; clicking Edit and Run works fine...


I have another two AppleScript Apps that reads from System Events - bothalready listed in Privay/Accessibility but both also fail with same error message but work fine from Edit/Run

Converting Scripts to Apps in Xcode took an hour or so but solved all the permission problems - thanks for the idea!

This doesn't work if the scripts are called from within another application. The application has the access, but the access doesn't pass to the scripts, and the scripts are hard-coded into the application.


mrf

A good illustration of this problem is to run the scheduling module in SuperDuper! Prior to Beta 6, everything ran like clockwork. Beginning with DP6, it won’t run unattended because every time the Copy Job.app gets accessed inside of SD! It requires the user to explicitly grant permission for Apple Events to use Copy Job, Finder to use Copy Job, and SuperDuper! To use copy job. If you don’t respond, the event times out with three errors, all -1712, which relate to system events. There is no way to get around this because there is no way to issue a one-time “sticky” authorization for each job. I have 4 scheduled jobs that runeach night. Every morning I wake up to 12 errors that each have to be dismissed before I can regain control of my desktop. THIS IS TOTALLY UNACCEPTABLE (and I’ve reported it as a bug, which is marked DUPE and closed). All of the security changes may eventually work out, but boy are they a PITA is this release. Wonder what new surprises DP 7 will bring.

I have run into the same issues with Red Sweater's excellent FastScripts. It works on one system requesting a notification to be added to "Automation," but not the other. This works ok with other apps.

I have added it to Accessibility, but that doesn not enter into it.


I have reset the system with tccutil - no change. Turned off SIP, deleted the db, etc. etc.


You should at least be able to add an app manually thy way you can with Accessibility.


Wasted two hours on this to help the poor developer on the other end - we are clueless.

This seeme to be related to Script Editor exports (scripts and Xcode projects still work) - does it do the same thing using Script Debugger or osacompile?

It is related to the originating application needing user permissions. Alas, this is not always getting triggered.