Return a value
Ends the macro successfully and hands a value back to whoever ran it.
Return value
Keyboard Maestro: Return
Details #
Ends the run as succeeded. Nothing after it runs. The value becomes the run's result. It is shown in the Trace, returned by the API and CLI, and delivered to a calling macro through Run macro (its into variable).
value may be any text, number, list or record, and may use {{ }}. A value that is exactly one {{ expression }} keeps its type. Leave it out to return nothing. If the macro declares what it gives back, a value of another type fails the run (see Functions).
- Set price to 20
- Return “{{ price * 1.2 }}”
Parameters #
| Parameter | Type | Required | Values | What it does |
|---|---|---|---|---|
value | any value | What to return. Optional. |
Every step also accepts label, onFailure, timeout and dryRunSafe.
Examples #
- If input is empty
- Return “nothing to do”
- Show “Got {{ input }}”
Gotchas #
Inside a loop it ends the whole macro. To leave only the loop, use Break out of repeat.
Unlike Stop macro, the run counts as a success.