This shows you the differences between two versions of the page.
Both sides previous revision Previous revision Next revision | Previous revision | ||
token:Calculate [2017/09/04 23:57] peternlewis [Calculate Token] |
token:Calculate [2023/11/09 22:29] (current) peternlewis |
||
---|---|---|---|
Line 1: | Line 1: | ||
- | {{:token:calculator-icon.png |}} | ||
===== Calculate Token ===== | ===== Calculate Token ===== | ||
Line 12: | Line 11: | ||
* 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]`, if MyVar is `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) | ||
+ | |||
+ | The //%Hex2%// token (v8+) returns the value in Hex format, padded with zeros to two digits. "2" is just an example, you can use //%Hex8%// for example. | ||
+ | |||
+ | The //%Dec2%// token (v8+) returns the value in decimal format, padded with zeros to two digits (similarly //%Dec5%// to five digits, etc). | ||
+ | |||
+ | 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** | **Example Action** | ||
Line 27: | Line 34: | ||
===== See Also ===== | ===== See Also ===== | ||
+ | |||
+ | ==== Actions ==== | ||
+ | |||
+ | * [[action:Set_Variable_to_Calculation|Set Variable to Calculation]] action | ||
+ | * [[:Actions|See all Actions]] | ||
=== Tokens === | === Tokens === | ||
- | * [[Hex|%Hex%]] token | + | * [[token:CalculateFormat|%CalculateFormat%]] token |
- | * [[Dec|%Dec%]] token | + | |
- | * [[Oct|%Oct%]] token | + | |
- | * [[Bin|% Bin%]] token | + | |
* [[/Tokens|All Tokens]] | * [[/Tokens|All Tokens]] | ||
- |