User Tools

Site Tools


token:Calculate

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
Next revision Both sides next revision
token:Calculate [2015/12/13 05:13]
JMichaelTX Updated to add formula choices, and clarify use of arrays
token:Calculate [2017/09/04 23:57]
peternlewis [Calculate Token]
Line 1: Line 1:
-{{:​token:​calculator-icon.png |}}===== Calculate Token =====+{{:​token:​calculator-icon.png |}} 
 +===== Calculate Token =====
  
-The //​%Calculate%//​**<​formula>​**//​%//​ token returns the **numeric** result of performing a calculation,​\\  ​+The //​%Calculate%//​**<​formula>​**//​%// ​[[:Tokens|token]] returns the **numeric** result of performing a calculation,​
 where //​**`<​formula>​`**//​ may be any of the following: where //​**`<​formula>​`**//​ may be any of the following:
   * Mathematical formula like `(2 + 3)*12`   * Mathematical formula like `(2 + 3)*12`
-  * Use any Variable which may be evaluated as a number, like\\ ​  `(MyVarWordsPerSec * 60)/​MyVarWordsPerPage` ​would yield the number of pages per minute+  * Use any [[token:Variable|Variable]] ​which may be evaluated as a number 
 +    * :!:  Just enter the Variable Name (without the `%`) in the Calculate token **`<​formula>​`** 
 +    * Examples: 
 +      * `%Calculate%MyVar + 1%` 
 +      * `%Calculate%(MyVarWordsPerSec * 60)/​MyVarWordsPerPage%`
   * Use any of the built-in Keyboard Maestro [functions](:​Functions),​ like [[function:​RANDOM|RANDOM(10)]]   * 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)+  * Get the numeric value of an Variable array element, like `MyVar[2]`, if MyVar is `10,​05,​12,​08` returns `5` (Arrays may contain only numeric data)
  
-A reminder that the following are only equivalent if the Variable is numeric:+**Example Action**
  
-[%Variable%Count%](Variable) +{{:​token:​km-7.3-calculate-token-example.png?​nolink|}} 
-* %Calculate%Count%+ 
 +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\\  ​ So, if MyVar is "​`005`",​ then\\  ​
   * %Variable%MyVar% will return `005`   * %Variable%MyVar% will return `005`
   * %Calculate%MyVar% will return `5`   * %Calculate%MyVar% will return `5`
 +
 +===== See Also =====
 +
 +=== Tokens ===
 +
 +* [[Hex|%Hex%]] token
 +* [[Dec|%Dec%]] token
 +* [[Oct|%Oct%]] token
 +* [[Bin|% Bin%]] token
 +* [[/​Tokens|All Tokens]]
 +
token/Calculate.txt · Last modified: 2023/11/09 22:29 by peternlewis