User Tools

Site Tools


Text_Fields

Text and Numeric Fields

Keyboard Maestro has two very distinct types of fields: text fields and numeric fields.

  • Most text fields allow the use of tokens.
  • Most numeric fields allow the use of Functions.

Text Fields

Text fields offer an area where the user can enter any text, including tokens . They may be single line, or multi-line, and may expand to more lines to fit (within limits) the content. They also contain non-printing control backslash characters (meta characters) such as \r, \n, \t, which are replaced by their value when the Macro and Action are executed (except in regular expression fields). Text fields can include the values of variables by using the Variable token, eg:

You can use a calculation in a text field using the Calculate text token, eg %Calculate%1+2%.

In most text fields, you can select the Gear popup menu to set processing options.

While editing a text field, a small T indicator can be seen in the top right corner of the field.

For details, see the Main Tokens page.

Numeric Fields

Numeric fields start out small, and usually have double arrows stepper next to them:

 Small Stepper Numeric Field

and then expand to allow more text if you type something other than a simple number:

 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 * DOW()”. To use a variable in a numeric field, you use it as is, without any adornment.

As soon as you type anything other than a digit, they expand to a larger size to allow for a calculation. Calculation fields never use percent text tokens.

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:

 Error Numeric Field

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. If you hold the option key down while selecting a function, you will get help on that function (from this wiki).

While editing a text field, a small C indicator can be seen in the top right corner of the field.

Variable Fields

Variable fields are similar to text fields, except they expect the name of a variable.

While editing a text field, a small V indicator can be seen in the top right corner of the field.

Script Fields

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.

See Also

Tokens

Topics

Forum

Text_Fields.txt · Last modified: 2022/11/30 22:35 by ccstone