action:Switch_or_Case
Differences
This shows you the differences between two versions of the page.
| Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
| action:Switch_or_Case [2016/11/27 23:15] – ADD example screenshot, icon, rewrite description JMichaelTX | action:Switch_or_Case [2022/09/18 02:49] (current) – [Switch/Case Action] peternlewis | ||
|---|---|---|---|
| Line 1: | Line 1: | ||
| - | {{: | + | ====== Switch/Case Action ====== |
| - | ====== Switch | + | |
| - | **The // | + | The //Switch/Case action// is used to perform different actions based on different values of a common _parameter_. |
| The _Switch_ Action is a good alternative to using multiple, nested, [[action: | The _Switch_ Action is a good alternative to using multiple, nested, [[action: | ||
| - | ---- | + | 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 |
| ===== Parameters ===== | ===== Parameters ===== | ||
| - | **The Switch _parameter_ may be any of the following:** | + | The Switch _parameter_ may be any of the following: |
| * [[: | * [[: | ||
| * [[: | * [[: | ||
| - | * [[: | + | * [[token: |
| + | * [[manual: | ||
| * Text (which can use [[: | * Text (which can use [[: | ||
| - | + | * [[manual: | |
| - | ---- | + | * File |
| ===== Default Configuration ===== | ===== Default Configuration ===== | ||
| Line 23: | Line 22: | ||
| When you insert the _Switch_ Action, it is configured to switch based on the _System Clipboard_, but can be easily changed to other parameters. | When you insert the _Switch_ Action, it is configured to switch based on the _System Clipboard_, but can be easily changed to other parameters. | ||
| - | {{:action:km-7.3-switch.png? | + | {{:action:switch-case.png? |
| 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. | 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 ===== | ===== Conditions ===== | ||
| + | The _Conditions_ available depend on the _Parameter_ that is chosen (for example, you cannot use *has an image* with a calculation). | ||
| - | The _Condition_ can be and of the following: | + | The _Conditions_ are defined as follows: |
| - | * has text of some sort. | + | ^Condition^Definition^ |
| - | * does not have text. | + | |is empty|The text is contains no characters.| |
| - | * has an image of some sort. | + | |is not empty|The text is contains some characters.| |
| - | * does not have an image. | + | |has text |Clipboard |
| - | * is exactly (case insensitively) a specified string. | + | |does not have text |Clipboard does not have any text items.| |
| - | * is not exactly (case insensitively) a specified string. | + | |has image |Clipboard has one or more images.| |
| - | * is alphabetically before | + | |does not have image |Clipboard does not have any images.| |
| - | * is alphabetically after a specified string. (v7.2+) | + | |is |is exactly (case insensitive) the specified string.| |
| - | * contains (case insensitively) a specified string. | + | |is not |is not exactly (case insensitive) the specified string.| |
| - | * does not contain (case insensitively) a specified string. | + | |contains |contains (case insensitive) the specified string.| |
| - | * matches | + | |does not contain |does not contain (case insensitive) the specified string.| |
| - | * does not match a specified regular expression. | + | |starts with |starts with the specified string.| |
| - | * has some flavor | + | |ends with |ends with the specified string.| |
| - | * does not have a flavor | + | |is before |is alphabetically before |
| - | * otherwise | + | |is after |is alphabetically after the specified string. (v7.2+)| |
| + | |matches | ||
| + | |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 | ||
| + | |does not conform to |Clipboard | ||
| + | |otherwise | ||
| - | 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. | ||
| - | |||
| - | ---- | ||
| + | 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 ===== | ===== See Also ===== | ||
| - | |||
| - | ---- | ||
| === Actions === | === Actions === | ||
| * [[action:If Then Else|If Then Else]] | * [[action:If Then Else|If Then Else]] | ||
| - | * [[action:Pause|Pause Until Conditions Met]] | + | * [[action:Pause_Until|Pause Until Conditions Met]] |
| * [[action: | * [[action: | ||
| * [[action: | * [[action: | ||
| Line 71: | Line 75: | ||
| * [[: | * [[: | ||
| - | |||
| - | ---- | ||
| ==== Forum ==== | ==== Forum ==== | ||
| - | - [[https://www.google.fr/search? | + | - [[https://forum.keyboardmaestro.com/t/ |
| + | - [[https://forum.keyboardmaestro.com/search?q=Switch%20action|Keyboard Maestro Forum topics about Switch or Case action]] | ||
action/Switch_or_Case.1480288521.txt.gz · Last modified: by JMichaelTX
