User Tools

Site Tools


token:Variable

**This is an old revision of the document!**

Keyboard Maestro Variables

Variable Tokens

The %Variable% token allows you to include a variable in a token text field. For Example,

Insert Text: Sally said “Hello” to %Variable%First Name%.

You can also use a short form of just %Variable Name% to include variables as long as the variable exists and has a value and there is no corresponding text token, although generally it is better and clearer to use the longer form %Variable%Variable Name%.

Variable Arrays

Variables can contain an array of comma separated numbers, like the image size (123,456) or window frame (100,120,600,550). In a calculation field, you can refer to these using a normal (1-based) index notation, like Variable[2]. So you can use ClipboardImageSize[1] and ClipboardImageSize[2].

It is important to note that variable arrays can contain only numeric values. When you use the %Calculate% function to reference a variable array element, it will convert the element to a number. So, in effect, you can only use variable arrays to store/reference numbers.

For example, suppose the variable MyArray has this value: 10,05,00,12 In any Keyboard Maestro Action where you would like to use the array element %Calculate%MyArray[2], it will return “5” because it has evaluated it as number, not the actual string of the element “05”.

token/Variable.1450003421.txt.gz · Last modified: 2015/12/13 05:43 by JMichaelTX