I Can't Get Screen Coordinates in Keyboard Maestro Version 5

Today I decided to fire KM 5.3.2 on one of my old machines. I tripped over the Calculate variable to get the screen coordinates with the SCREEN function. The same failure trapped me with getting the Window coordinates through the WINDOW function. Typing parentheses, the closing one got colored red, with the action yielding no result. Is it a bug or did I get it wrong? I had no trouble with other functions.

The KM Engine log generated several messages Calculation SCREEN(0) failed with error at 8

image

See: SCREEN function.

The SCREEN function requires at least two parameters, SCREEN(0,Left) for example.

Thank you. Indeed the documentation regarding this syntax was too lax.

However, another example includes the inability of the calculate action to extract members of an array, as shown below. I used the demonstration laid out in the KM 5 under the Calculations section to a "T" to replicate the logic:

KM 5's template:

Set variable ‘Temp’ To Text ‘%FrontWindowFrame%’
Set variable ‘Temp’ To Calculation ‘Temp[1]+Temp[3]/2,Temp[2]+Temp[4]/2’
Use ‘Temp’ to Set the Mouse Location

image

How so?

Did you try it? The variable This_screen currently has a value of "" (the macro has not been run, and the first action shows the current value before the arrow). Since it is empty, the calculation is invalid. Later versions ofd Keyboard Maestro (ones that are not 10 years out of date) show it as orange in the case where the calculation is invalid currently, but could be valid if the variable had a different value.

image

2 Likes

How so?

It should've been unambiguous about the number of arguments the function takes. It may not be clear by itself for some people.