The Switch or 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.
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.
The Conditions available depend on the Parameter that is chosen:
The Conditions are defined as follows:
Condition | Definition |
---|---|
has text | has text of some sort, i.e. it is not empty. |
does not have text | does not have text, i.e., it is empty. |
has image | has one or more images on the clipboard. |
does not have image | does not have any images on the clipboard. |
is | is exactly (case insensitive) a specified string. |
is not | is not exactly (case insensitive) a specified string. |
is before | is alphabetically before a specified string. (v7.2+) |
is after | is alphabetically after a specified string. (v7.2+) |
contains | contains (case insensitive) a specified string. |
does not contain | does not contain (case insensitive) a specified string. |
matches | matches a specified regular expression. |
does not match | does not match a specified regular expression. |
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 above 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.