Move window to the top - NOT left or right

I’m trying to write a macro to move the front window to the top of the screen (↓ 22) without changing its width or moving it left or right. Unfortunately, every variable, token, or calculation I put in the → field is incorrect and not evaluated. I’m sure I’m missing something that seems simple, but I’m stumped. Any tips?

This seems to work, presuming your screen height is less than 1600 pixels:

Here's a sample macro that shows how to do this:

Move Window to Top.kmmacros (1.8 KB)

2 Likes

Gabe, thanks. That did the trick.

Jim, although your solution would also work for me, I prefer on principle to apply solutions that don’t depend on a particular environment. Nevertheless, I very much appreciate your response!

1 Like

Mine would work in any environment if you change the vertical number to the pixel height of your screen (or the pixel height minus 22 for the menu bar). Or you could make it a number that exceeds any used screen (such as -9999) and it would work on any screen, regardless of height.

1 Like

You can get the height of the screen containing the front window with the calculation SCREEN(Front,Height).

Here is version 2.0 of mine, using Peter's method:

1 Like