User Tools

Site Tools


Text_Fields

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
Text_Fields [2016/12/26 14:49]
alain add internal links + JMTX template
Text_Fields [2019/07/01 01:07]
peternlewis
Line 1: Line 1:
 +====== Text Fields ======
 +
 Keyboard Maestro has two very distinct types of fields: text fields and numeric fields. ​ Most text fields are text token fields. Most numeric fields are calculation fields. Keyboard Maestro has two very distinct types of fields: text fields and numeric fields. ​ Most text fields are text token fields. Most numeric fields are calculation fields.
  
-The difference is usually obvious. ​Numeric fields start out small, and usually have double arrows stepper next to them:+===== Numeric Fields ===== 
 + 
 +Numeric fields start out small, and usually have double arrows stepper next to them:
  
-{{ :action:​numericfieldsmall.png?​nolink |}}+{{ action:​numericfieldsmall.png?​nolink&​587x31 ​Small Stepper Numeric Field }}
  
 and then expand to allow more text if you type something other than a simple number: and then expand to allow more text if you type something other than a simple number:
  
-{{ :action:​numericexpanded.png?​nolink |}}+{{ action:​numericexpanded.png?​nolink&​587x55 ​Expanded Numeric Field }}
  
 They are designed to allow you to enter a specific numeric value. In these fields, you can type a raw calculation,​ which can include variables and functions. Eg "Count + 2 * [[function:​DOW|DOW()]]"​. To use a variable in a numeric field, you use it as is, without any adornment. They are designed to allow you to enter a specific numeric value. In these fields, you can type a raw calculation,​ which can include variables and functions. Eg "Count + 2 * [[function:​DOW|DOW()]]"​. To use a variable in a numeric field, you use it as is, without any adornment.
Line 15: Line 19:
 If the function is invalid, it will highlight in red. Keep in mind that the expression may be invalid simply because a variable it references does not yet have a value. If you have not set the Count variable to a value, then the above action would look like this: If the function is invalid, it will highlight in red. Keep in mind that the expression may be invalid simply because a variable it references does not yet have a value. If you have not set the Count variable to a value, then the above action would look like this:
  
-{{ :action:​numericerror.png?​nolink |}}+{{ action:​numericerror.png?​nolink&​587x55 ​Error Numeric Field }}
  
-This is nothing inherently wrong with the action - the variable Count just does not currently have a numeric value.  ​In v7.0+, expressions ​that are invalid only because a variable is not currently valid will show in orange instead of red.+This is nothing inherently wrong with the action - the variable Count just does not currently have a numeric value.  ​Expressions ​that are invalid only because a variable is not currently valid will show in orange instead of red.
  
-You can insert functions into numeric fields using the *Edit ➤ Insert Function* menu. In v7.0+ if you hold the option key down while selecting a function, you will get help on that function (from this wiki).+You can insert functions into numeric fields using the *Edit ➤ Insert Function* menu. If you hold the option key down while selecting a function, you will get help on that function (from this wiki).
  
-Text fields, on the other hand, start out larger. They may be single line, or multi-line, and may expand to more lines to fit (within limits) the content. Text token fields process [[:​Tokens|text tokens]] which are marked with percents, like *%CurrentClipboard%* or *%Variable%My Variable%* and typically (but not always) have an Insert Token pull down menu.  They also process backslash characters (eg \r, \n, \t, etc) (except in regular expression fields). Text fields can include the values of variables by using the Variable token, eg:+===== Text Fields ===== 
 + 
 +Text fields, on the other hand, start out larger. They may be single line, or multi-line, and may expand to more lines to fit (within limits) the content. Text token fields process [[:​Tokens|text tokens]] which are marked with percents, like *%CurrentClipboard%* or *%Variable%My Variable%* and typically (but not always) have an Insert Token pull down menu.  They also process backslash characters (eg `\r``\n``\t`, etc) (except in regular expression fields). Text fields can include the values of variables by using the Variable token, eg:
  
 {{ :​action:​tokenfield.png?​nolink |}} {{ :​action:​tokenfield.png?​nolink |}}
Line 27: Line 33:
 You can use a calculation in a text field using the Calculate text token, eg *%Calculate%1+2%*. You can use a calculation in a text field using the Calculate text token, eg *%Calculate%1+2%*.
  
-You can insert text tokens into text fields using the *Edit ➤ Insert Token* menu. In v7.0+ if you hold the option key down while selecting a token, you will get help on that token (from this wiki).+You can insert text tokens into text fields using the *Edit ➤ Insert Token* menu. If you hold the option key down while selecting a token, you will get help on that token (from this wiki).
  
-Text token fields also process %NN% or %NNNN% as arbitrary hex unicode characters (eg %41% is an A), and (except for regular expression fields) process backslashed characters \a,​\b,​\e,​\f,​\t,​\r,​\n (bell,​backspace,​escape,​form feed,​tab,​return,​line feed).+Text token fields also process %NN% or %NNNN% or %NNNNNN% as arbitrary hex unicode characters (eg %41% is an A, %01F300% is 🌀), and (except for regular expression fields) process backslashed characters \a,​\b,​\e,​\f,​\t,​\r,​\n (bell,​backspace,​escape,​form feed,​tab,​return,​line feed).
  
-To include ​a percent in your text, simply double ​the percent (%%). To include a backslash \ in your text, double the backslash (\\).+Text tokens can also include the [[manial:​Tokens#​Text_Case_Conversions|Text Case Conversion]] characters like `\U` and `\L`.
  
-Almost every field in Keyboard Maestro actions is either a numeric field or text token field. The major exceptions are script fields.  ​Scripts are not processed for text tokensthey must access variables through [other means](http://www.keyboardmaestro.com/​documentation/​6/​scripting.html).+In most text fields, you can select (in the BUTTON{{{⚙}}} menu) whether to process normally, ​or just tokens (not backspashed characters) or do no text processing at all.  ​Alternatively,​ to include a percent in your text, simply double the percent ​(%%)To include a backslash \ in your text, double the backslash (\\).
  
-Prior to version 7.0, the Select Menu Item action did not process text tokens, but it had its [[action:​Select_or_Show_a_Menu_Item|own processing methods]].+===== Script Fields =====
  
-===== See Also =====+Almost every field in Keyboard Maestro actions is either a numeric field or a text token field. The major exceptions are script fields. ​ Scripts are not processed for text tokens, they must access variables through [other means](http://​www.keyboardmaestro.com/​documentation/​6/​scripting.html).
  
-----+===== See Also =====
  
 === Tokens === === Tokens ===
Line 52: Line 58:
  
 * [[:​Frequently Asked Questions|FAQ]] * [[:​Frequently Asked Questions|FAQ]]
- 
----- 
  
 ==== Forum ==== ==== Forum ====
Line 62: Line 66:
  
 - [[https://​forum.keyboardmaestro.com/​t/​how-to-insert-return-between-appended-clipboard-snippets/​5862/​2|How to Insert RETURN between appended clipboard snippets]] - [[https://​forum.keyboardmaestro.com/​t/​how-to-insert-return-between-appended-clipboard-snippets/​5862/​2|How to Insert RETURN between appended clipboard snippets]]
- 
- 
  
Text_Fields.txt · Last modified: 2022/11/30 22:35 by ccstone