简体   繁体   中英

Apple Automator Applescript action giving “could not connect action” error

I'm running into an error when I try to run an Automator action from within an App. I set it up as a Service. It works when I run it from within automator, but when I call the service it gives me a dialog error that reads:

The action "Run AppleScript encountered an error"

I checked the logs and it turns out the full error is:

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.

You can see my Workflow here :

It is made up of two parts: 1) An "Ask for Text" action 2) a "Run AppleScript" action that takes the text from 1, does things with it, and then prompts the user to "choose from list"

Again, this all works when I run it in Automator, but it fails when I call it as a Service from within an App.

PS: once that is solved, I would love some help to have the focus move to the "ask for text" dialog so I can trigger the action and start typing my answer.

Not sure what did it, but it is working now.

The only thing I can think of is that I closed Automator.

I was recently receiving the same error message with an Automator service. The problem was due to Automator auto appending "..." after 'end run' in the applescript code. I have code completion turned on in Applescript Editor, so the 3 dots show up when the editor has possible completions to suggest, and it does this within Automator as well.

For some reason it was appending those dots after 'end run', in the 'Run Applescript' automator action window, after I closed Automator. So this was the last line of my script: "end run..." So I appended a space after 'run', which removed the trailing periods for good, and the service now runs fine.

I'm not sure this is the problem you're experiencing, but it's probably worth checking.(Frustrating problem, I know.)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM