pocketfullofcheese
pocketfullofcheese

Reputation: 8857

"ask for text" action in Apple automator does not receive focus automatically

I wrote an Service using Apple's Automator. The first action is an "Ask for Text" action. However, when I trigger the shortcut to initiate the service, the modal asking for text pops up, but it does not have focus. I have to use the mouse to click on it.

Is there any way to have automator open this window with the focus on the text input?

Upvotes: 11

Views: 4290

Answers (2)

David Steer
David Steer

Reputation: 256

Add some applescript to the top of your workflow with the following code. Just replace myapp with your app name

tell application "myapp"
activate
end tell

Upvotes: 24

Mark
Mark

Reputation: 636

This is a sort-of, works-for-me, partial answer; instead of using the Ask for text action, I just used an applescript within my automator app (instead of the Ask..action, I used the "Run applescript" action). it looks like this:

on run {input, parameters}

    set x to the text returned of (display dialog "Enter a version number" default answer "1134" buttons {"OK"} default button 1)


    return x
end run

My lil' automator application was to help me enter version numbers for tickets; using the mouse makes my hand hurt. The applescript dialogs seem to have focus properly, so enjoy! Let us know how you do!

Upvotes: 4

Related Questions