Wait for a change
Pauses until the clipboard, the front window or the screen changes, or fails when it does not within the timeout.
Wait for what to change
Keyboard Maestro: Pause Until Change, PauseUntilChange
Details #
Takes a reading of what you chose, then checks again until it differs from the first reading. When it does, the step ends and the macro continues. If nothing changes before the timeout, the step fails.
What counts as a change, with what:
clipboard(the default): the clipboard's change count. Copying anything, even the same text again, counts. Checked every 0.1 seconds.window: the front app, or the position or size of its front window. Checked every 0.1 seconds.screen: a screenshot of the screen compared by checksum. Any visible change counts, including a clock. Checked every 0.5 seconds.
The output holds changed: true and waited, the seconds spent waiting.
Parameters #
| Parameter | Type | Required | Values | What it does |
|---|---|---|---|---|
timeout | number | Seconds to wait. The step's own timeout (10 seconds by default) is also a ceiling, so set the step's timeout as well for waits longer than that. The wait is never shorter than half a second. | ||
what | one of | clipboard window screen | clipboard, window or screen. Default clipboard. Anything else fails. |
Every step also accepts label, onFailure, timeout and dryRunSafe.
Examples #
- Show “Copy something within 5 seconds” for 2 s
- Wait for the clipboard to change
- Read the clipboard into copied
- Show “You copied: {{ copied }}” for 2 s
Gotchas #
When nothing changes the step fails with "the clipboard didn't change within 5 s" (with the thing you chose and the limit). Set
onFailuretocontinueif timing out is fine.screentakes screenshots, which is the heaviest of the three and may need Screen Recording permission.Only the first reading is compared. A change that is undone before the next check is missed.
In a dry run the step is simulated and does not wait.