Fill a form in a native app without stealing focus
Goal. An agent fills in a form in TextEdit, a settings dialog or any native app, and you keep typing in your own window the whole time.

Commands
Section titled “Commands”Type into the app by name. Nothing changes focus:
aos key type "Jane Doe" --app=TextEditaos key press tab --app=TextEditaos key type "jane@example.com" --app=TextEditaos key press enter --app=TextEditCheck the text actually landed:
aos key type "hello" --app=TextEdit --verify--verify reads the text back from the app’s text field and exits 1 if it did not arrive.
Some apps only accept input when they are focused. Hand focus over for the duration of the command and get it back after:
aos key type "hello" --app=Chrome --focus
What to tell an agent
Section titled “What to tell an agent”Fill in the name field in TextEdit with Jane Doe and the email with jane@example.com, without taking my focus. Verify the text arrived.
Gotchas
Section titled “Gotchas”- Key names are lower case with
+.cmd+shift+s,ctrl+a,enter,tab,esc. --appposts events to that window. The app must be running with a window. Exit 3 means no window matched.- Focus-free input does not work in every app. Some apps ignore posted events. Try
--focusbefore concluding the field is unreachable. - Point at the right field first. Combine with
aos mouse click --app=TextEdit --find="Email"to land in the field by its label.