If and Repeat
Most shortcuts run straight down the list. Two steps change that. If runs a group of steps only when something is true, and Repeat runs a group a fixed number of times.
Both are ordinary steps from the drawer. Adding one drops in its closing step at the same time, End of If or End of Repeat, so a block is always complete and can’t be left half-open.
An If step holds a single comparison: a left-hand value, an operator, and (for most operators) a right-hand value.
- is / is not: exact match. Comparisons are case-sensitive, so
Inboxandinboxare different values. - contains: the left value contains the right one anywhere inside it. An empty right-hand value never matches.
- has a value: the left value isn’t blank. No right-hand value.
- is empty: the left value is blank. No right-hand value.
Either side can be a literal or a token, so {{clipboard}} contains github.com is a valid condition. The chips under the condition put a value into the side you last clicked. A token that nothing in the shortcut saved counts as empty here, and the editor notes it. See Tokens.
Add Else (on the If step, and in its ⋯ menu) drops an Else marker into the block. The steps below it run when the condition is not met. One Else per If, and it’s optional: without one, a false condition just skips to End of If.
Repeat
Section titled “Repeat”A Repeat step takes a count and runs everything inside it that many times. The count can be a plain number or a token such as {{input}}: type it, or pick it from the chips under the field.
A single loop is capped at 10,000 iterations. A count that comes from a token is checked when the shortcut runs: above the cap the run stops, and below zero the loop runs no times. There’s also a ceiling on the total number of steps one run may execute, which nested loops can reach. Either way the run stops cleanly rather than locking up.
Putting steps inside a block
Section titled “Putting steps inside a block”When the last step is the end of a block, buttons beside Add a step put the new step inside it: Add inside “Repeat”, Add inside “If…”, and Add inside “Else” once the If has one. Add a step itself adds after the block. To put a step anywhere else, use the + between steps.
Blocks move as a unit. Drag an If or Repeat (or its End row) by its handle, or use its arrows, and everything inside goes with it. Drag a step onto a gap within a block to put it there; moving a step up or down one place hops over a neighboring block instead of landing in it.
Removing a block
Section titled “Removing a block”From the block’s ⋯ menu, Remove, keep the steps inside takes away only the block’s own rows, so the steps from an If then always run, and the steps from a Repeat run once. Remove with the steps inside deletes the whole block. Either one is a single Undo.
Ask for input pairs naturally with If: ask for a value, then branch on what was typed. See Ask for input.