Move and resize finder windows sporadically failing

I have a macro that just has 4 "move and resize window" commands. They're all using "the window with title" and they're all move/resizing Finder windows.

If I run the macro 10 times, I might get 3 or 4 failures with window not found errors. And the errors will be random windows.

As far as I can tell, this should be a very straightforward macro. Any idea what could be causing the problem?

Yes, you might be affected by an Apple bug, as explained in the following link. You might find a solution in the following thread.

It might help if you state which version of macOS and which version of KM you are using. Certain versions are impacted differently.

What I would try to do to address your issue is to modify your code to not just move the window, but after the move, check if the move worked by fetching the new window's coordinates, and if the move was not successful, move the window again, repeatedly. (Notice the word "repeatedly.") In my opinion, this will likely fix your problem. but my opinions are correct only 80% of the time.

Not moving windows "correctly" is one thing (@Airy's covered that) but not even finding them is another! Post your macro and, if it doesn't give too many secrets away, a screen shot of your pre-move window layout in case someone can spot something.

Here's the Macro. But note that I moved everything into try/catch for troubleshooting and turned off "notify on failure".

As you can see, it's a very basic macro.

I'm running MacOS Sonoma 14.4.1 and KM 11.0.2 on a MacBook Pro M1.

@Airy Thanks, I'll check out the link about the OS bug and consider the workaround.

And here's a screenshot of my desktop/Finder windows. Again, I don't think there's anything "special" about my setup.

Also, FWIW, the macro fails both when I'm only on my laptop, and/or when I'm connected to multiple external monitors.

Manipulate a Window Action (v11.0.2)

Manipulate a Window.kmactions (1.1 KB)

Keyboard Maestro Export

Could you have another go, uploading the macro rather than a single action? (A mistake I make every other day, TBH...)

I thought that's what I did :man_facepalming:t2:

Second time's the charm?

move/resize finder windows - manual Macro (v11.0.2)

move-resize finder windows - manual.kmmacros (16 KB)

I think I see a bug in your code. You have a space before "on my desk". Forgive me if I'm wrong.

Nice catch, but there is a space in the beginning of that folder's name (for sorting purposes).

Well, as I said above, some of your problems will probably be fixed if you replace your "move" action with a "move" action inside a loop that repeatedly checks if the "returned" position (or size) of the window matches the target position (or size.) You may find sample code for that in the thread that I cited above. I think I posted sample code that does that in one of the threads that talk about this.

Yep, that's what I'll do. Thanks for all your help!

Not so sure -- that's a good fix for when windows are moved but not to the required position, while @edjusted says they're getting "window not found" errors. That implies that either window isn't present or the name isn't exactly as expected.

@edjusted -- for troubleshooting purposes, try starting your macro with an "Activate Finder" action and replace your "Display Text briefly"s with

Then, when the action fails, you'll have a list of currently-open window titles to compare against.

I agree! That's why I said some of your problems would be fixed with my idea.