“不允许进行辅助访问"从 Java 运行 AppleScript 时出错 [英] "is not allowed for assistive access" error when running AppleScript from Java

查看:96
本文介绍了“不允许进行辅助访问"从 Java 运行 AppleScript 时出错的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个 Jenkins 配置,它使用 Maven 为 OS X 应用程序执行 Java 测试.当我尝试运行一些需要辅助访问的 AppleScript 时,会出现不同的错误.所以我尝试通过两种方式执行 AppleScript:

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. 使用脚本引擎:

ScriptEngineManager mgr = new ScriptEngineManager();ScriptEngine 引擎 = mgr.getEngineByName("AppleScriptEngine");engine.eval(脚本);

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

在这种情况下,脚本执行失败并出现错误:发生了 -10810 类型的错误.

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

  1. 调用 osascript.在这种情况下,错误看起来像:系统事件出错:不允许 osascript 辅助访问.(-1719)
  1. Calling osascript. In this case error looks like: System Events got an error: osascript is not allowed assistive access. (-1719)

在可访问性列表中,我有以下内容:SystemUIServer、脚本编辑器、osascript、java、mvn、bash、终端.在脚本编辑器或终端的 osascript 中运行脚本时,脚本通过而没有任何错误.

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?

推荐答案

我想你可以回答你自己的问题.您可以允许对脚本编辑器进行辅助访问(除其他外).它在脚本编辑器中运行良好.

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.

这篇关于“不允许进行辅助访问"从 Java 运行 AppleScript 时出错的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆