User Tools

Site Tools


action:Switch_or_Case

Switch/Case Action

The Switch/Case action is used to perform different actions based on different values of a common parameter. It is very similar to the JavaScript Switch statement.

The Switch Action is a good alternative to using multiple, nested, If/Then Actions.

The actions in the first section that matches will be executed. If no section matches, then no actions will be executed and the execution will continue after the Switch/Case action. Under no circumstances will actions from more than one section be executed - that is, execution does not “fall through” to following sections as happens in some languages.

Parameters

The Switch parameter may be any of the following:

Default Configuration

When you insert the Switch Action, it is configured to switch based on the System Clipboard, but can be easily changed to other parameters. It initially looks like this:

For each Condition that you add, you can enter zero or more Actions that will be executed when that Condition is met. After those Action(s) are executed, or if no Conditions are met, the Switch Action is exited.

Conditions

The Conditions available depend on the Parameter that is chosen (for example, you cannot use has an image with a calculation).

The Conditions are defined as follows:

ConditionDefinition
is emptyThe text is contains no characters.
is not emptyThe text is contains some characters.
has text Clipboard has at least one item containing text of some sort.
does not have text Clipboard does not have any text items.
has image Clipboard has one or more images.
does not have image Clipboard does not have any images.
is is exactly (case insensitive) the specified string.
is not is not exactly (case insensitive) the specified string.
contains contains (case insensitive) the specified string.
does not contain does not contain (case insensitive) the specified string.
starts with starts with the specified string.
ends with ends with the specified string.
is before is alphabetically before the specified string. (v7.2+)
is after is alphabetically after the specified string. (v7.2+)
matches matches the specified regular expression.
does not match does not match the specified regular expression.
is <is numerically less than.
is ⇐is numerically less than or equal.
is =is numerically equal.
is >=is numerically greater than or equal.
is >is numerically greater than.
is !=is numerically not equal.
conforms to Clipboard has an item with the UTI class that conforms to the specified Uniform Type Identifier.
does not conform to Clipboard does not have an item with the UTI class that conforms to the specified Uniform Type Identifier.
otherwise will execute if none of the Conditions in the Switch, that are entered above otherwise, are met.

The Otherwise Condition will execute if none of the previous Conditions are met. The Switch Action will then exit. So, the Otherwise Condition should always be placed as the last Condition in the Switch Action.

See Also

Actions

Conditions

Forum

action/Switch_or_Case.txt · Last modified: 2022/09/17 22:49 by peternlewis