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

2

11

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?

Meander answered 30/8, 2012 at 17:11 Comment(1)
this is driving me nuts right this very minute. i'll do some more research and if no love i'll start a bounty.Galvin
E
24

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
Ellene answered 6/2, 2013 at 14:45 Comment(2)
You can also just use 'activate' by itself.Brasher
I added an applescript action at the top of the workflow that just does "activate" and it works. thanks!Meander
G
4

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!

Galvin answered 19/10, 2012 at 21:19 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.