Easiest way to get window sizes and positions for Keyboard Maestro?

Recently, I’ve dived into using Keyboard Maestro for setting up computing environments. One of the things I love most about KB vs other solutions (Workflow, Bunch) is how much control there is over window sizes, position, and interaction with windows, particularly in a multi-screen workstation.

The one thing I’m finding very frustrating/annoying is figuring out the pixel locations and sizes of windows in order to embed them in my scripts. Does anyone know of an easy way to, say, position your windows just where you want them and then “grab” the screen position and size in a format that KM can use?

This is pretty easy: %FrontWindowFrame% KBM Wiki


I would also add that the keyboard maestro forum is an amazing place, with a bit more traffic than here (and thus likely faster answers).

1 Like

Ok, cool…so you’re suggesting I should set up a Macro in KB just to measure the window sizes first, and then use those measurements in the workflow automation…?

1 Like

That’s a great idea, thanks. I know I probably have an account there, but I think I totally forgot it existed. :upside_down_face:

In Keyboard Maestro’s Window menu is an item called “Mouse Display.” Turn that on and it tells you exactly where your mouse is on the screen. It can also tell you how far it is from a corner of the window, or from the corners of the screen.

1 Like

Cool trick, thank you!

For anyone else researching this issue, I found two other things which have been helpful. First of all, there are two apps (currently available on Setapp) that assist with screen measurements and locations: PixelSnap and QuickLens.

Secondly, I found this gem in the KeyboardMaestro documentation for Window Tokens.

I set a window to the size and position that I want, then use KM’s “set system clipboard to text” for window position and window size to get those values:

And then I use those values in a “Move and Resize Window” action:

It’s a little bit of work, but it has enabled me to apply very precise window locations to a set of hotkeys.

Hope this is useful!


1 Like

Nice! I think I might try to set up something similar.