Window Positioning Issues

I put together a macro to move windows across 3 different monitors of different sizes.

With a single hot key, I can move the front window to 4 different positions across the screens, and continue by jumping the window to the next screen - In total there are 12 positions.

Referencing the video http://goo.gl/ywkHwK, I reference the monitors from left to right as Monitor 1, Monitor 2, and Monitor 3, respectively. Monitor 3 is the Macbook Pro, for which the other monitors are connected.

For this explanation, Monitor 1 possesses positions 1,2,3 and 4, Monitor 2 has positions 5, 6, 7, and 8, and Monitor 3 has positions 9, 10, 11, and 12.

The issue is that, when moving from position 9 to 10, 10 to 11, 11 to 12, in all these cases, the front window jumps briefly to position 1. It is this jumping to position 1 that I am trying to resolve.

I have done a bit of debugging, etc. and my configuration is likely “unique”. So not sure if the problem is on my end, KM, or Apple, or some combination thereof.

With that, I will yield to the forum.

The AC API does not like moving any part of windows off the screen. So the actual move/resize action, is something akin to:

Set Postion
Set Size
Set Position
Set Size
Set Position
Set Size

The position and size is the same in each case. This deals with the cases like resizing to the whole screen (where if you try to change the size first, the window would be off the screen and it would fail, and then the move would work, but the window would be the wrong size), and resizing to half the screen from a full screen window (where if you try to move first, the window would fail to move, and then the resize would happen, but the window would still be in the wrong position.

I imagine its a similar artifact going on here. The the initial Set Position is making some part of the window off screen, and then the system is deciding that the left most screen is really a good spot for the window.

You can try ensuring that the size is small enough to start with.

The way I was previously doing this macro, I would say that I was resizing off screen. But right now, I use commands such as that in the included photo, where the system has generated the size (a size I guess should be appropriate since it is system generated).

The main Macro is structured as per the image below. Note that the final repositioning of the window is only the last set, employing the use of system-defined window placement.

I can try running some tests using very small window sizes.

There is no accessibility way to move & resize. So, as I said, Keyboard Maestro is performing the sequence:

Set Postion
Set Size
Set Position
Set Size
Set Position
Set Size

If the initial size of the window is such that it cannot fit on screen 3 (perhaps because screen 3 is not as tall as screen 2?), then that position setting will fail (and that is probably what is happening - the system is trying to move the window there, and deciding that the only way to fit the window is to move it to an entirely different screen).

Then the resize will happen, then the second set position will happen, and now, with the smaller size, the move will succeed.

So, duplicate your action for this case, and change the first one to Resize, and that should likely resolve the problem.

OK, thanks Peter. Interesting scenario. I will report back when I revisit this.

Hei!
I have the last ver of KM.
But I can’t find "Move and resize window"
Where to find that?

Geir

Hey Geir,

Search the ‘All Macros’ category in the Actions-Inspector (Menu View > Show Actions) for window.

You’ll find a Manipulate a Window action, and contained within it is what you seek.

-Chris

[image: Innebygd bilde 2]
Hi, and thanks for your time!
As you can see it is not possible to reach.
Geir

[image: Innebygd bilde 1]
Got a little bit longer, but cant find Move window...
Geir

Hey Geir,

Good. you noticed that 'Start Editing Macros' must have been activated in order to get to the Actions Inspector.

In the action itself you missed the pop-up menu for selecting the desired window-action.

-Chris

Thanks, to all of you who have contributed!
Geir