Browse the docs

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:

whatFires whenThe run starts with
value (default)the element's text differs{old, new, app, window}
rowsa 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}
selectionwhat 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 #

ParameterTypeRequiredValuesWhat it does
apptextYesThe app, by bundle id. Required.
locatorlocatorYesThe element. Required.
asany value
debouncenumber
fieldsrecord
keytext
whatone ofvalue rows selection, debounce, fields, as, key.

Examples #

Show it when a status label changes
When
  1. Status text in ActivityMonitor changes
Do
  1. Show “{{ old }} → {{ new }}” for 2 s
Open in Switchboard to try it

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