当我尝试从应用程序中运行 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:一旦解决了,我希望得到一些帮助,让焦点移到“询问文本”对话框,这样我就可以触发操作并开始输入我的答案。