Browse the docs

Wait

Pauses for a number of seconds, or waits until an element, window or app appears or goes away.

Wait pause seconds

Keyboard Maestro: Pause, PauseUntil

Details #

Wait has four forms. Which one runs depends on the params. The pause form is chosen first, then these are checked in order:

  1. A pause. pause is set, with no locator, window or app: wait that many seconds, then go on. A pause runs as long as it says, up to what is left of the macro's own timeout; it isn't cut at the 10 seconds a step gets by default.

  2. An element. locator is set: wait until it exists. With gone, wait until it no longer exists.

  3. A window. window is set: wait until a window of the app has that title (or a title containing it, ignoring case). With gone, wait until no window has it.

  4. An app. Only app is set: wait until the app is running. With gone, wait until it has quit.

Waiting for a condition polls the screen until it is true or the step's timeout runs out. The default timeout is 10 seconds. Set timeout on the step, or in its params, to change it. On timeout the step fails and the Trace shows what it looked for and what it found instead.

An element wait does not require the element to be enabled. The output reports the match and how long the wait took.

Prefer waiting for what you need next over a fixed pause. A pause is always as long as you set it. A wait ends the moment the thing is there.

Parameters #

ParameterTypeRequiredValuesWhat it does
apptextA bundle id. With locator or window, it says which app to look in. Alone, it is the app to wait for.
fuzzyyes / noFor element waits, accepts a match between 40% and 70% instead of failing. It is flagged "fuzzy match" in the Trace.
goneyes / noWait for the thing to disappear instead of appear.
locatorlocatorThe element to wait for. Select the step and press Re-record in the editor, then click the element.
pausenumberSeconds to wait. Used alone.
timeoutnumberSeconds to wait before giving up. The default is 10.
windowtextA window title, or part of one.

Every step also accepts label, onFailure, timeout and dryRunSafe.

Examples #

Pause for one second
Do
  1. Wait 1 s
  2. Show “Done” for 1 s
Open in Switchboard to try it

Open Notes and wait until its window is up before the next step:

Open Notes and wait for its window (really opens the app)
Do
  1. Activate ‹app›
  2. Wait for window “Notes”, up to 15 s
Open in Switchboard to try it

Gotchas #

  • pause together with locator, window or app is not a pause. The locator, window or app wait runs and pause is ignored.

  • A step with none of these fails with "needs a locator, a window, an app or a pause".

  • A dry run skips waits unless you mark the step Safe in dry run.

See also #

Click, Activate app, Quit app, Read field value