This shows you the differences between two versions of the page.
Next revision | Previous revision Next revision Both sides next revision | ||
token:Calculate [2015/07/15 06:24] peternlewis created |
token:Calculate [2016/03/13 04:26] AlainLifchitz cosmetic change |
||
---|---|---|---|
Line 1: | Line 1: | ||
- | The //%Calculate%1+2%// token returns the result of performing a calculation. | + | {{:token:calculator-icon.png |}}===== Calculate Token ===== |
+ | |||
+ | The //%Calculate%//**<formula>**//%// [[:Tokens|token]] returns the **numeric** result of performing a calculation,\\ | ||
+ | where //**`<formula>`**// may be any of the following: | ||
+ | * Mathematical formula like `(2 + 3)*12` | ||
+ | * Use any [[token:Variable|Variable]] which may be evaluated as a number, like\\ `(MyVarWordsPerSec * 60)/MyVarWordsPerPage` would yield the number of pages per minute | ||
+ | * Use any of the built-in Keyboard Maestro [functions](:Functions), like [[function:RANDOM|RANDOM(10)]] | ||
+ | * Get the numeric value of an Variable array element, like `MyVar[2]`\\ "`10,05,12,08`" returns "`5`" \\ (Arrays may contain only numeric data) | ||
+ | |||
+ | A reminder that the following are only equivalent if the [[token:Variable|Variable]] is numeric: | ||
+ | |||
+ | * %Variable%Count% (Variable) | ||
+ | * %Calculate%Count% (Number) | ||
+ | |||
+ | So, if MyVar is "`005`", then\\ | ||
+ | * %Variable%MyVar% will return `005` | ||
+ | * %Calculate%MyVar% will return `5` | ||
- | This allows you to include any [function](:Functions) in a text field. |