How to activate a HTML prompt and focus on field?

I am having trouble getting access to the window in applescript, and I am also unsure how I would find a specific field inside of it and focus on it so my computer is prepared to input into it.

Not sure if I understand your question.

When building an HTML prompt you can use the autofocus attribute.

For example:

<input id="essName" accesskey="n" placeholder="File name" type="text" size="27" autofocus>

That solved my problem completely! Thank you!

But for future reference, how can I find a dialog window using applescript? When an HTML prompt is selected it appears to not be part of any application. In Applescript, applications, contain windows. So where would I find this a window that is not part of any application?

It belongs to the Keyboard Maestro Engine process.

This gets you a list of its windows:

tell application "System Events"
  tell application process "Keyboard Maestro Engine"
    get every window
  end tell
end tell

Launch your HTML prompt and run the script in Script Editor or Script Debugger. Your prompt window should be listed in the result.

1 Like

By using the name of your prompt window you can then access the further elements.

For example:

tell application "System Events"
  tell application process "Keyboard Maestro Engine"
    tell window "Optimize PNG"
      every UI element
    end tell
  end tell
end tell


On that topic there are a couple of threads on this forum. For example…

1 Like

Just checked and this worked. Thank you again, will certainly read up on this.