User Tools

Site Tools


action:Switch_or_Case

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
Next revision Both sides next revision
action:Switch_or_Case [2016/12/08 14:22]
JMichaelTX Clarified Switch Conditions
action:Switch_or_Case [2017/09/07 01:51]
peternlewis
Line 1: Line 1:
 {{:​action:​switch-icon.png?​nolink|}} {{:​action:​switch-icon.png?​nolink|}}
-====== Switch ​or Case Action ======+====== Switch/Case Action ======
  
-**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 [[https://​developer.mozilla.org/​en-US/​docs/​Web/​JavaScript/​Reference/​Statements/​switch|JavaScript Switch]] statement.+**The //Switch/Case action// is used to perform different actions based on different values of a common _parameter_.** ​ It is very similar to the [[https://​developer.mozilla.org/​en-US/​docs/​Web/​JavaScript/​Reference/​Statements/​switch|JavaScript Switch]] statement.
  
 The _Switch_ Action is a good alternative to using multiple, nested, [[action:​If_Then_Else|If/​Then]] Actions. The _Switch_ Action is a good alternative to using multiple, nested, [[action:​If_Then_Else|If/​Then]] Actions.
- 
----- 
  
 ===== Parameters ===== ===== Parameters =====
Line 15: Line 13:
   * [[:​Variables|Keyboard Maestro Variable]]   * [[:​Variables|Keyboard Maestro Variable]]
   * Text (which can use [[:​Tokens|Tokens]])   * Text (which can use [[:​Tokens|Tokens]])
- 
----- 
- 
  
 ===== Default Configuration ===== ===== Default Configuration =====
Line 28: Line 23:
  
 ---- ----
 +===== Example ===== 
 +See this Forum Topic for a downloadable example:​\\ 
 +[ACTION: Switch Case Based on FrontMost App](https://​forum.keyboardmaestro.com/​t/​action-switch-case-based-on-frontmost-app/​7294)
  
 ===== Conditions ===== ===== Conditions =====
Line 38: Line 35:
  
 ^Condition^Definition^ ^Condition^Definition^
-|has text |has text of some sort, i.e. it is _not_ empty.| +|has text |Clipboard ​has at least one item containing ​text of some sort.| 
-|does not have text |does not have text, i.e., it _is_ empty.| +|does not have text |Clipboard ​does not have any text items.| 
-|has image |has one or more images ​on the clipboard.| +|has image |Clipboard ​has one or more images.| 
-|does not have image |does not have any images ​on the clipboard.| +|does not have image |Clipboard ​does not have any images.| 
-|is |is exactly (case insensitive) ​specified string.| +|is |is exactly (case insensitive) ​the specified string.| 
-|is not |is not exactly (case insensitive) ​specified string.| +|is not |is not exactly (case insensitive) ​the specified string.| 
-|is before |is alphabetically before ​specified string. (v7.2+)| +|is before |is alphabetically before ​the specified string. (v7.2+)| 
-|is after |is alphabetically after specified string. (v7.2+)| +|is after |is alphabetically after the specified string. (v7.2+)| 
-|contains |contains (case insensitive) ​specified string.| +|contains |contains (case insensitive) ​the specified string.| 
-|does not contain |does not contain (case insensitive) ​specified string.| +|does not contain |does not contain (case insensitive) ​the specified string.| 
-|matches |matches ​specified regular expression.| +|matches |matches ​the specified regular expression.| 
-|does not match |does not match specified regular expression.|+|does not match |does not match the specified regular expression.|
 |conforms to |Clipboard has an item with the UTI class that conforms to the specified [Uniform Type Identifier](https://​en.wikipedia.org/​wiki/​Uniform_Type_Identifier).| |conforms to |Clipboard has an item with the UTI class that conforms to the specified [Uniform Type Identifier](https://​en.wikipedia.org/​wiki/​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.| |does not conform to |Clipboard does not have an item with the UTI class that conforms to the specified Uniform Type Identifier.|
Line 61: Line 58:
  
 ===== 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:​Until|Execute Action Until Conditions Met]] * [[action:​Until|Execute Action Until Conditions Met]]
 * [[action:​While|Execute Action While Conditions Met]] * [[action:​While|Execute Action While Conditions Met]]
Line 75: Line 70:
  
 * [[:​Conditions|See all Conditions]] * [[:​Conditions|See all Conditions]]
- 
----- 
  
 ==== Forum ==== ==== Forum ====
  
-- [[https://www.google.fr/search?q=site:​forum.keyboardmaestro.com+Switch+action|Keyboard Maestro Forum topics about Switch or Case action]] +- [[https://forum.keyboardmaestro.com/​search?​q=Switch%20action|Keyboard Maestro Forum topics about Switch or Case action]]
  
action/Switch_or_Case.txt · Last modified: 2022/09/17 22:49 by peternlewis