Apple Automator Applescript操作提供“无法连接操作”错误

时间:2012-07-28 20:08:04

标签: macos applescript automator

当我尝试在App中运行Automator操作时,我遇到了错误。我将其设置为服务。当我从automator中运行它时,它可以工作,但是当我调用该服务时,它会给我一个对话框错误,内容如下:

The action "Run AppleScript encountered an error"

我检查了日志,结果发现完整的错误是:

12-07-28 1:03:01.319 PM com.apple.automator.xpc.workflowServiceRunner: Could not connect the action buttonPressed: to target of class NSApplication
12-07-28 1:03:01.319 PM com.apple.automator.xpc.workflowServiceRunner: 2012-07-28 13:03:01.317 WorkflowServiceRunner[77170:1707] Could not connect the action buttonPressed: to target of class NSApplication
12-07-28 1:03:01.319 PM com.apple.automator.xpc.workflowServiceRunner: Could not connect the action buttonPressed: to target of class NSApplication
12-07-28 1:03:01.320 PM com.apple.automator.xpc.workflowServiceRunner: 2012-07-28 13:03:01.318 WorkflowServiceRunner[77170:1707] Could not connect the action buttonPressed: to target of class NSApplication
12-07-28 1:03:01.320 PM com.apple.automator.xpc.workflowServiceRunner: Could not connect the action buttonPressed: to target of class NSApplication
12-07-28 1:03:01.320 PM com.apple.automator.xpc.workflowServiceRunner: 2012-07-28 13:03:01.319 WorkflowServiceRunner[77170:1707] Could not connect the action buttonPressed: to target of class NSApplication
12-07-28 1:03:01.321 PM com.apple.automator.xpc.workflowServiceRunner: Could not connect the action buttonPressed: to target of class NSApplication
12-07-28 1:03:01.321 PM com.apple.automator.xpc.workflowServiceRunner: 2012-07-28 13:03:01.320 WorkflowServiceRunner[77170:1707] Could not connect the action buttonPressed: to target of class NSApplication
12-07-28 1:03:01.358 PM com.apple.automator.xpc.workflowServiceRunner: -[AMApplicationRegistry loadDefinitionAtURL:]: No application name for definition at URL file://localhost/Library/Automator/Office.definition/
12-07-28 1:03:01.358 PM com.apple.automator.xpc.workflowServiceRunner: 2012-07-28 13:03:01.356 WorkflowServiceRunner[77170:1707] -[AMApplicationRegistry loadDefinitionAtURL:]: No application name for definition at URL file://localhost/Library/Automator/Office.definition/
12-07-28 1:03:01.358 PM com.apple.automator.xpc.workflowServiceRunner: -[AMApplicationRegistry _loadDefinitionsAtURLS:]: Failed to load definition at URL file://localhost/Library/Automator/Office.definition/
12-07-28 1:03:01.358 PM com.apple.automator.xpc.workflowServiceRunner: 2012-07-28 13:03:01.357 WorkflowServiceRunner[77170:1707] -[AMApplicationRegistry _loadDefinitionsAtURLS:]: Failed to load definition at URL file://localhost/Library/Automator/Office.definition/
12-07-28 1:03:06.787 PM com.apple.automator.xpc.workflowServiceRunner: WorkflowServiceRunner received error running Workflow Service at /Users/juan/Library/Services/Lookup Citation.workflow: The action “Run AppleScript” encountered an error.
12-07-28 1:03:06.787 PM com.apple.automator.xpc.workflowServiceRunner: 2012-07-28 13:03:06.786 WorkflowServiceRunner[77170:1707] WorkflowServiceRunner received error running Workflow Service at /Users/juan/Library/Services/Lookup Citation.workflow: The action “Run AppleScript” encountered an error.

您可以看到我的工作流here

它由两部分组成: 1)“询问文本”动作 2)“运行AppleScript”操作,从1开始执行文本,对其执行操作,然后提示用户“从列表中选择”

同样,当我在Automator中运行它时,这一切都有效,但是当我在App中将其称为服务时,它会失败。

PS:一旦解决了,我希望得到一些帮助,让焦点转移到“询问文本”对话框,这样我就可以触发动作并开始输入我的答案。

2 个答案:

答案 0 :(得分:0)

不知道是做了什么,但它现在正在运作。

我唯一能想到的是我关闭了Automator。

答案 1 :(得分:0)

我最近收到了与Automator服务相同的错误消息。问题是由于Automator在applescript代码中的'end run'之后自动追加“...”。我在Applescript编辑器中打开了代码完成功能,因此当编辑器有可能完成建议时会显示3个点,并且它也会在Automator中执行此操作。

出于某种原因,在我关闭Automator之后,在“运行Applescript”自动机操作窗口中,在“结束运行”之后添加了这些点。所以这是我脚本的最后一行:“end run ...”所以我在'run'之后添加了一个空格,它删除了尾随时段,现在服务正常运行。

我不确定这是你遇到的问题,但它可能值得检查。(令人沮丧的问题,我知道。)