Keyboard Maestro 7
Conduct your Mac Like a Pro!
Keyboard Maestro supports calculations in almost any numeric text fields. For example you can Pause for "60*Time in Minute"s. Calculations can also use comma separated lists of numbers as arrays, and can return such arrays, so you can operate on frames and points, for example:
Set variable ‘Temp’ To Text ‘%WindowFrame%1%’ Set variable ‘Temp’ To Calculation ‘Temp.x+Temp.width/2,Temp.y+Temp.height/2’ 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, many built-in functions, various numeric bases, so you should be able to write almost any expressions you might like to use, as well as use it as a general purpose calculator if desired.
Operators based on precedence from lowest to highest are:
To minimize conflict with variables, operators and functions must be in uppercase.
The available functions are listed on the wiki Functions page.
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). You can reference these values as arrays (eg Variable[2] would be 34 in either case), but for clarity, you can reference these values using dot notation:
Some example expressions might be:
Amount in Dollars * 100 MJD() > 55928 NOW() > TIME(2012,3,23,12,2,1) DOW(TIME(2012,4,4)) = 4 Radius*SIN(20°),Radius*COS(20°) Window Frame[1]+Window Frame[3]/2,Window Frame.MidY MOUSEBUTTON() + 2 * MOUSEBUTTON(4) SCREEN(Internal,Left,10%)