The Set Variable to Text action allows you to set a selected variable to plain text, by either typing in the text box, or selecting a Token.
Alternatively (v9.0+), you can Prepend the text to the variable, or Append the text to the variable by selecting from the action (gear) ⚙ menu.
See below for how to use dynamic variable names.
There is no need to use any operators when combining text with multiple variables or other tokens. Just enter the text and variables/tokens as you would like them to appear in the Variable being set by this Action.
You can append directly to a variable with the Append variant of the action:
or equivalently using text tokens to expand the variable:
Configure the Action as Needed
%TokenName%, or select it from the popup list under Insert Token.
Unlike most places you specify a variable, the variable name itself is a text token field, so you can set a variable whose name changes.
The Set Variable to Text action allows you to control what text processing happens in the gear menu (7+) :
Most other Text Fields in Keyboard Maestro process both text tokens and (except for regular expression fields) backslash characters.
Tip: leave notes for yourself about what you're doing. Click on the gear icon at top right of the action to select Set Note…. A window appears where you can enter text. Click the OK button to save the text of the note for future reference.
In some languages, this is known as indirection, where one variable is really referring to another variable. This is a bit complicated, and you may not often need it, but it is very useful when you do need it.
This requires two steps (two Actions):
The Steps Are
%%) in places where you want the result to be one
%%Variable%%myVar%Variable%myVarNum%%% TEXT BECOMES %% % Variable Variable %% % myVar myVar %Variable%myVarNum% 2 %% % RESULT WHEN EXECUTED %Variable%myVar2%
Since the Variable Name block of the Set Variable to Text Action accepts tokens, we can just use it directly if we just need to concatenate two more more Variables, with optional text.
myAddress, and then set that Variable to the results in the Text Area block.