1

当我尝试从应用程序中运行 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.

你可以在这里看到我的工作流程:

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

同样,当我在 Automator 中运行它时,这一切都有效,但是当我从应用程序中将它作为服务调用时它会失败。

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

4

2 回答 2

0

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

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

于 2012-07-28T21:14:28.233 回答
0

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

出于某种原因,在我关闭 Automator 之后,它在“运行 Applescript”自动操作窗口中的“结束运行”之后附加了这些点。所以这是我脚本的最后一行:“结束运行......”所以我在“运行”之后附加了一个空格,它永久删除了尾随句点,现在服务运行良好。

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

于 2013-04-01T22:57:04.473 回答