Mojave error Using AppleScript to Send JavaScript to Fluid browser: "Not authorised to send Apple events to [...] (-1743)"


I'm using a small Applescript to send a "do Javascript" command to a Fluid browser (named Fastmail). Worked perfectly before Mojave, but after upgrading I get the dreaded error: "Not authorised to send Apple events to Fastmail. (-1743)". I presumed I would get a popup where I could allow Keyboard Maestro to control Fastmail, but no such thing. Is there something else I could try?

Check your System Preferences, Security & Privacy, Automation preferences. Hopefully it lists Keyboard Maestro, and within it the browser, and then all you need to do is enable permission (the system probably asked you once for permission and you said no, and then it never asks you again).

Alternatively, maybe the browser is not recognised by OS X and doesn't appear there, in which case you may be out of luck.

Unfortunately it seems to be the latter. If I change the Applescript to tell application "Safari", I get a pop requesting access. Not sure really why Mojave isn't "recognizing" the browser, as it's showing up as a browser in the other suspected places ("Open In" etc). Anything I can point the developer towards that could be implemented to make the browser recognized by Mojave to allow sending Apple events?

It may be that it is not properly signed or whatever.

I don't know that there is any way to force the system to add the application to the Automation preferences.

You might try putting your script in a scriplet and compiling that and seeing if that works…?

Thanks for response @peternlewis - it's probably got to do something w/ the fact that it isn't signed properly. When I run codesign -v on it I get this:

mdbraber:~ $ codesign -v ~/Applications/
/Users/mdbraber/Applications/ invalid Info.plist (plist or signature have been modified) 

Unfortunately it also gives the same error when trying to run the script through osascript from the commandline. I'll have to see if there are any other alternatives available...

1 Like

You need to remove the invalid signature from the Fluid app:

codesign --remove-signature

Fantastic! That did the trick - thanks so much!