Browse the docs

Last action result

Passes when the step that ran just before succeeded or failed.

The last step state

Keyboard Maestro: Action Result (Succeeded, Failed)

Details #

Tests how the most recent step ended. succeeded passes when it did not fail; failed passes when it failed or timed out. It is most useful after a step with onFailure set to continue, so the macro carries on and then decides what to do.

Flow-control steps (if, repeat, group and the like) do not count as the last action; the last step that actually did something does. Before any step has run there is nothing to have failed, so succeeded passes and failed doesn't. The trace shows failed.

The same facts are available as the run variables actionFailed (true or false) and actionResult (the step's output text, or its failure message), unless your macro sets a variable by those names.

Every condition accepts "negate": true, which flips the verdict. The trace records what was compared before the flip, so a negated condition that blocks a macro still shows the real values.

Conditions in an Only if list combine with all: every one must pass, and an empty list always passes. An if step or a repeat loop takes a match of all (default) or any.

Parameters #

ParameterTypeRequiredValuesWhat it does
stateone ofYessucceeded failedsucceeded or failed.

Examples #

React to a failed step
Do
  1. Run shell script “exit 1”
  2. If the last action failed
  3. Show “The shell step failed”
  4. Else
  5. Show “The shell step worked”
Open in Switchboard to try it

Gotchas #

  • The shell step in the example is only simulated by Try it, so the failure branch shows in a real run. It runs exit 1, which is harmless.

  • Without onFailure: continue (or branch) a failed step stops the macro before the condition is reached.

  • Unknown states fail with unknown action result state.

See also #