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.
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.
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