An element in an app changes
Watches one element of an app (a label, a field, a list, the selection) and runs the macro when its text changes, a new row appears or the selection moves.
When locator changes
Details #
Watches the element locator finds in app, whenever the app is running. It is looked for again after the app launches or the window changes. what says what counts as a change:
| what | Fires when | The run starts with |
|---|---|---|
value (default) | the element's text differs | {old, new, app, window} |
rows | a row appears in the table or list that was not there before (rows are told apart by key, else by their whole text) | {added, count, app, window} |
selection | what is selected changes: the selected rows of a list, or the selected text | {rows, text, app, window} |
The first look only records what is there now. debounce (300 ms by default) merges a burst of changes, so a field you type into fires once it settles. fields, as and key shape the rows exactly as in Read the rows of an app's list.
The app tells Switchboard when something changes, and it also looks every two seconds, because not every app says so. Nothing is watched while no enabled macro uses the trigger.
Parameters #
| Parameter | Type | Required | Values | What it does |
|---|---|---|---|---|
app | text | Yes | The app, by bundle id. Required. | |
locator | locator | Yes | The element. Required. | |
as | any value | |||
debounce | number | |||
fields | record | |||
key | text | |||
what | one of | value rows selection | , debounce, fields, as, key. |
Examples #
- Status text in ActivityMonitor changes
- Show “{{ old }} → {{ new }}” for 2 s
Gotchas #
The element has to be found by the locator in the app's windows. A label in a window that is closed is not there, and nothing fires until it is.
An app that does not post change notifications is looked at every two seconds, so a change shorter than that can be missed.
See also #
Read the rows of an app's list, Read all the text of an app's document, Read field value