token:Calculate
Differences
This shows you the differences between two versions of the page.
| Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
| token:Calculate [2015/12/13 10:13] – Updated to add formula choices, and clarify use of arrays JMichaelTX | token:Calculate [2023/11/10 03:29] (current) – peternlewis | ||
|---|---|---|---|
| Line 1: | Line 1: | ||
| - | {{: | + | ===== Calculate Token ===== |
| - | The // | + | The // |
| where // | where // | ||
| * Mathematical formula like `(2 + 3)*12` | * Mathematical formula like `(2 + 3)*12` | ||
| - | * Use any Variable which may be evaluated as a number, like\\ | + | * Use any [[token:Variable|Variable]] |
| + | * :!: Just enter the Variable Name (without the `%`) in the Calculate token **`< | ||
| + | * Examples: | ||
| + | * `%Calculate%MyVar + 1%` | ||
| + | * `%Calculate%(MyVarWordsPerSec * 60)/ | ||
| * Use any of the built-in Keyboard Maestro [functions](: | * Use any of the built-in Keyboard Maestro [functions](: | ||
| - | * Get the numeric value of an Variable array element, like `MyVar[2]`\\ "`10, | + | * Get the numeric value of an Variable array element, like `MyVar[2]`, if MyVar is `10, |
| - | A reminder that the following are only equivalent if the Variable | + | The //%Hex2%// token (v8+) returns |
| - | * [%Variable%Count%](Variable) | + | The //%Dec2%// token (v8+) returns the value in decimal format, padded with zeros to two digits (similarly //%Dec5%// to five digits, etc). |
| - | * %Calculate%Count% | + | |
| + | The //%Oct3%// token (v8+) returns the value in octal format, padded with zeros to three digits (similarly //% Oct5%// to five digits, etc). | ||
| + | |||
| + | The //%Bin8%// token (v8+) returns the value in binary format, padded with zeros to eight digits (similarly //% Bin16%// to 16 digits digits, etc). | ||
| + | |||
| + | **Example Action** | ||
| + | |||
| + | {{: | ||
| + | |||
| + | A reminder that the following are only equivalent if the [[token: | ||
| + | |||
| + | * %Variable%Count% (Variable) | ||
| + | * %Calculate%Count% | ||
| So, if MyVar is " | So, if MyVar is " | ||
| * %Variable%MyVar% will return `005` | * %Variable%MyVar% will return `005` | ||
| * %Calculate%MyVar% will return `5` | * %Calculate%MyVar% will return `5` | ||
| + | |||
| + | ===== See Also ===== | ||
| + | |||
| + | ==== Actions ==== | ||
| + | |||
| + | * [[action: | ||
| + | * [[: | ||
| + | |||
| + | === Tokens === | ||
| + | |||
| + | * [[token: | ||
| + | * [[/ | ||
token/Calculate.1450001582.txt.gz · Last modified: by JMichaelTX
