Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

"is not allowed for assistive access" error when running AppleScript from Java

I have a Jenkins config that executes Java tests for OS X app using Maven. And when I'm trying to run some AppleScript that requires assistive access for it, different errors appear. So I've tried to execute AppleScript in two ways:

  1. Using ScriptEngine:

    ScriptEngineManager mgr = new ScriptEngineManager(); ScriptEngine engine = mgr.getEngineByName("AppleScriptEngine"); engine.eval(script);

In this case script execution fails with error: An error of type -10810 has occurred.

  1. Calling osascript. In this case error looks like: System Events got an error: osascript is not allowed assistive access. (-1719)

In accessibility list I have following things: SystemUIServer, Script Editor, osascript, java, mvn, bash, Terminal. When running script in Script Editor or in osascript from Terminal, script passed without any errors.

Any suggestions what else should I check?

like image 415
Kirill Aleksandrov Avatar asked Sep 06 '25 03:09

Kirill Aleksandrov


1 Answers

I think you answer your own question. You can allow assistive access for Script Editor (among other things). It works fine in Script Editor.

You can try and add other applications to have assistive access. This might be an option if Script Editor does not give you want you want.

enter image description here

like image 64
Nick Groeneveld Avatar answered Sep 08 '25 17:09

Nick Groeneveld