What am I doing wrong? Trying to manipulate window with variables


Ever since the Sonoma update all my window manipulation macro's have been behaving erratically. I know about other threads where that is being discussed and possible workarounds like repeat loops suggested, but they're not really working.

So I wanted to try something else: capture the screen dimensions first in variables, and then move/resize to those variables, to see if that makes a difference, but I'm doing something wrong:

What's wrong here?

Thanks & cheers --Mike

You only need to tokenize variables in Text fields. Coordinates are entered into Calculation fields, so you can remove the tokenization and simply enter the variable names.



...rather than...


1 Like

Thanks! Silly me. Unfortunately the workaround does not seem to work :frowning:

Cheers --Mike

You don't actually need to use variables at all:

I know, but I was testing if the SCREEN function was part of the problem of the erratic window behaviour I've been experiencing since Sonoma (and never before). So I wanted to calculate the dimensions beforehand and then apply those. But to no avail.

Thanks --Mike

This works for me:

OK that's the same steps I wanted and that I have working now, but for me it does not change the erratic window behaviour.

Thanks --M.

I'm not on Sonoma so can't really help with that. Good luck. :+1:t3:

I believe there has been another thread about this subject, which I can't find right now. I have erratic behaviour also. But it is temporarily fixable by modifying your macro. If you put your macro into a loop that repeats the action like this:

Yes, this results in the window moving several times until it reaches the full window size. But it seems to solve the problem for now. At least for me.

That seems like a brilliant hack, thanks! I do hope that @peternlewis will be able to fix the Sonoma/Window manipulation issues.

Thanks all! --Mike

Thanks for the compliment. I think the problem may be that The Architect doesn't have Sonoma installed yet on his development Mac and therefore hasn't experienced this issue.

And as solutions go, this one is kinda funny because it makes the window "dance."

1 Like

It is not a Sonoma issue - it is a macOS bug that sometimes animates the changes, and that when animating the window size changes does not handle the size being changed while the position animation is in progress (or vice versa). It long predates Ventura, but when it happens may be more or less prevalent in different applications and different versions of macOS.

Keyboard Maestro 11.0.2 resolves it by slowing down the change so that the move happens and then 0.3 seconds later (after any animate) the size change happens. This is reliable (hopefully) but unfortunately slow.

I cannot do the equivalent of the until loop that @Airy describes internally (I tried!) because if I keep a reference to the window, then the system lies to me about the position/size of the window, and if I were to refind the window (as Airy’s action effectively does) each time and if the front window were to change while that resize is happening, then the action will start acting on the new window. You could see this using the action that Airy posted by triggering the macro and then as it is resizing change the front window. With timing, you'll get the first window partially changed and the second window changed fully.

1 Like

Hello @peternlewis,

Thanks for all your continued work on this beautiful utility that is Keyboard Maestro!

It must be frustrating indeed that you're not able to manipulate windows in a predictable way.

I've installed the update and it seems to work now but is indeed a tad slower and more visible.

Cheers & thanks again --Mike

1 Like