How Do I Resize a Window on My External Monitor (Screen)?

I want to create a macro that moves a window on my external monitor to top right and than resizes it. However I can't do that it seems.

This action only resizes windows in my 'macbook screen' :

What I have currently is pretty close to what I want but I can't make KM resize in X direction. I resize my window to top right with BetterTouchTool :

I then have a macro like so :

And this works nearly perfect as it does resize the window by Y direction from this :

to this :

But I can't make it resize it in X direction. Nothing happens as I change the parameter. :frowning:

I want to have this window :

Can I do this somehow?

Instead of "Main", use "External".
See SCREEN function (KM Wiki) for a list of the Index Names that can be used.


Thank you lot Michael. I still can't resize it like I want.

This this parameter for stretching does nothing.

How can I shrink it in X and still keep to the side as I showed in my screen?

Instead of “50%”, use “0.5”.

This still doesn't resize the window at all. Only moves it top right.

If I understood you correctly :

1 Like

You are still using "50%".

This works for me:

Just tried it with your settings. For me it doesn’t shrink in the X at all. It shrinks it in Y if I change the 0.5 variable but for width, change that 0.5 does nothing.

Don’t know what to say, other than please double-check all settings.
It works perfectly for me on multiple tests, multiple apps.

It should be the same, but instead of “*0.5” you could use “/2”

Here’s another approach.

Use “Front” instead of “External”.

Oh wow. It worked. It made the window the perfect size. Here are the settings :

However the window is not in top right corner. It's somewhere here :

Changing the first variable responsible for moving windows sideways only moves it to the left for some reason and doing this doesn't work either :

Take a close look at your setting for the LEFT position.
It should be:
SCREENVISIBLE(External,Right) - (SCREENVISIBLE(External,Width) * 0.28)

You will have to change this to match the fraction you use for resizing the width.

1 Like

This works amazingly. Thank you so much. :blue_heart:

I hope you don’t mind that I have revised the title of your topic to better match the contents:

FROM: KM cannot resize a window like I want
TO: How Do I Resize a Window on My External Monitor (Screen)?

1 Like

No, it is greatly appreciated as it makes it much easier to search for in case someone else has a similar problem. :slight_smile:


50% and 0.5 are the same in Keyboard Maestro, so this was not the issue.

Width: SCREENVISIBLE(External,Width)*100%

does not make sense since modern Macs do not really allow windows off the screen, and that would result in a window that had its left side in the middle of the external screen and its right side way off the right of the external screen which is not allowed.

Width: SCREENVISIBLE(External,Width)*50%

Should result in the window being on the right side of the external screen.

X: SCREENVISIBLE(External,Right)-SCREENVISIBLE(External, Width)*N%
Width: SCREENVISIBLE(External, Width)*N%

Should result it in being N% of the width and on the right side of the screen, for any given N (note that windows may have minimum sizes).

But I’m not eniterly sure where @nikivi went wrong before then or whether it was just a subtle error somewhere.

If any of the above does not work, I’d like to see a text display showing: