documentation:Calculations
Differences
This shows you the differences between two versions of the page.
| documentation:Calculations [2016/05/26 07:30] – created peternlewis | documentation:Calculations [Unknown date] (current) – removed - external edit (Unknown date) 127.0.0.1 | ||
|---|---|---|---|
| Line 1: | Line 1: | ||
| - | ====== Calculations ====== | ||
| - | |||
| - | Keyboard Maestro supports calculations in almost any numeric [[/ | ||
| - | |||
| - | < | ||
| - | Set variable ‘Temp’ To Text ‘%WindowFrame%1%’ | ||
| - | Set variable ‘Temp’ To Calculation ‘Temp.x+Temp.width/ | ||
| - | Use ‘Temp’ to Set the Mouse Location | ||
| - | </ | ||
| - | |||
| - | will result in the mouse being placed at the center of the front window. | ||
| - | |||
| - | Note: You must use commas for this purpose, and full stops (.) for decimal numbers, and never use any thousands separators, regardless of your desired language. | ||
| - | |||
| - | Keyboard Maestro’s expressions include precedence, nested bracketed expressions, | ||
| - | |||
| - | Operators based on precedence from lowest to highest are: | ||
| - | |||
| - | | array separator (,) | separates elements of an array | | ||
| - | | ternary operator (?) | a=b ? 3 : 4 | | ||
| - | | bitwise or (%%|%%), bitwise and (&) and bitwise xor | operators | | ||
| - | | comparison operators (<, ≤, =, >, ≥, ≠) | compare for (in)equality and return 0 or 1 | | ||
| - | | shift operators (≪, ≫) | shift a number left or right | | ||
| - | | addition operators (+, -) | add or subtract | | ||
| - | | multiplication operators (*, /, MOD) | multiply, divide or mod | | ||
| - | | power operator (%%^%%) | exponentiation | | ||
| - | | unary prefix operators (√ (Option-V), -, brackets) | square root, negation, sub-expressions | | ||
| - | | functions | a large variety of functions | | ||
| - | | numbers and variables or array accesses (5, | ||
| - | | unary postfix operators (!,%,° (Option-Shift-8)) | factorial, percent, degrees | | ||
| - | |||
| - | To minimize conflict with variables, operators and functions must be in uppercase. | ||
| - | |||
| - | The available functions are listed on the [[/ | ||
| - | |||
| - | Keyboard Maestro refers to points as strings with two values, like 12,34 and to rectangles as four values 12,34,56,78 (with a fifth value for fuzz in some instances). | ||
| - | |||
| - | | Variable.x | x coordinate | | ||
| - | | Variable.y | y coordinate | | ||
| - | | Variable.left | the left coordinate of a rectangle | | ||
| - | | Variable.top | the top coordinate of a rectangle | | ||
| - | | Variable.right | the right coordinate of a rectangle | | ||
| - | | Variable.bottom | the right coordinate of a rectangle | | ||
| - | | Variable.width | the width of a rectangle or size | | ||
| - | | Variable.height | the height of a rectangle or size | | ||
| - | | Variable.fuzz | the fuzz of an image match (rectangle, | ||
| - | | Variable.MidX | the horizontal middle of a rectangle | | ||
| - | | Variable.MidY | the vertical middle of a rectangle | | ||
| - | |||
| - | Some example expressions might be: | ||
| - | |||
| - | < | ||
| - | Amount in Dollars * 100 | ||
| - | MJD() > 55928 | ||
| - | NOW() > TIME(2012, | ||
| - | DOW(TIME(2012, | ||
| - | Radius*SIN(20°), | ||
| - | Window Frame[1]+Window Frame[3]/ | ||
| - | MOUSEBUTTON() + 2 * MOUSEBUTTON(4) | ||
| - | SCREEN(Internal, | ||
| - | </ | ||
documentation/Calculations.1464247805.txt.gz · Last modified: by peternlewis
