A form field takes focus
Runs the macro when an email, name, address, phone or similar text field takes focus in any app or web page.
A kind field takes focus
Details #
Looks at the text field that just took focus, in any app, and works out what it is for from its placeholder, description, title, the label next to it and, on a web page, the element's id and class names. When it recognises a kind of field it runs the macro.
The kinds it knows: email, name, firstName, lastName, phone, address, city, postcode, company, url, search, code (a one-time code) and date. A field it cannot place does nothing. A promo code is not a one-time code, and a username or file name is not a person's name.
Password fields never fire. A secure text field is skipped before anything about it is read.
The macro gets these inputs:
| Input | What it holds |
|---|---|
kind | One of the kinds above. |
label | The text that identified the field, such as Email address. |
app | The bundle identifier of the app. |
url | The front browser tab's address when the app is a browser. |
{{triggerValue}} is the label.
This trigger does not type into the field. Write a macro that shows a HUD or a list and fills the field only when you press a key.
Parameters #
| Parameter | Type | Required | Values | What it does |
|---|---|---|---|---|
app | text | A bundle identifier. Only fields in that app count. | ||
kind | one of | any email name firstName lastName phone address city postcode company url search code date | One of the kinds above, or any (the default). |
Every trigger also takes Limits: a cooldown, the first time each day, every nth time, twice within seconds, a chance, only while you are at the Mac, on one Mac, or in a State. See Limits on any trigger.
Examples #
- An email field takes focus
- Ask to choose from 0 options
- Type “{{ pick }}”
Gotchas #
Switchboard only watches while at least one turned-on macro uses this trigger.
Many web pages give their fields no useful name. Those fields are not recognised.
Writing into fields unasked is how autofill tools get blocked by banking sites, so the shipped example offers and waits for you.