Debug Window Manipulation

Using KM 8.0.4, I think I found a bug with WINDOW(0, Width). Is there a way to print its value so I can confirm? I'm able to print window & screen positions. With that I see things like (-403,-1417,847,1406) for %WindowPosition%1 when on my top monitor. When I adjust display arrangement in mac's system preferences so that the left edges line up, that left position is 0 and my macro works as expected. Thanks!

Move-Left.kmmacros (12.4 KB)

It is working fine for me running Keyboard Maestro 8.0.4 (8.0.4) on macOS 10.11.6.

You can use the %Calculate% token to display the results of a KM function in a Display Window Action:

Negative values are expected in multi-monitor setups, as I understand it.

  • The zero values are for the top left origin of the main display, and points on any display configured above or to the left of that should have negative values.
  • You can arithmetically translate those negative coordinates (relative to the main display's origin) into (positive) coordinates relative to a secondary monitor's upper left, by taking account of display widths / heights.

(Obtain the x-shift and y-shift from Main display origin to Secondary display origin, and apply its reverse to any coordinate on the secondary display that you need)

The formulation at:[]=windowframe


Like all coordinates in Keyboard Maestro, the WindowPosition and WindowFrame are from the top left corner of the main screen (the defined one with the menu bar on it, although this is less apparent now that the menu bar is on all monitors).

@JMichaelTX The %Calculate% token helps a lot. I confused SCREENVISIBLE(Front, Width) with SCREENVISIBLE(Front, Left) in some places. @ComplexPoint That explains it. Thanks! I’ll try that with Set Variable to Calculation action so I don’t have to re-compute for each condition. Let me know if you have a better way to tackle that.

1 Like