I frequently use a variation of the macro below to resize windows and switch between window positions on two monitors.
With Mac apps, though, particularly Pages and Numbers, the macros do not work consistently or at all. I wasn’t able to find a simple solution by searching this forum or the web.
Resizing windows with the accessibility API will only work while the window stays on the screen. Also, there is no move&resize API, so the move and resize has to be two different commands, which Keyboard Maestro repeats (move, resize, move, resize) to try to mitigate this. On top of that, recent versions of macOS animate the moves and cannot cope with the commands happening while they are animating, so Keyboard Maestro has relatively long delays built in by default (if you turn them off, then the actions become unreliable, so if you have turned them off in the past, that would be a possible reason for your unreliability).
Since you are resizing to the full possible height, that may be part of the problem - insetting it from the edges may gain reliability.
You asked how to make the window 99% instead of 100%. But I see you are using "100%" in your actions above. If you change those values to 98%, that would be a start. You may also have to add "1%" to your Top and Left fields to indent the windows. But there may be more problems than just that.
Recent versions of macOS have changed how the implement the API for moving and resizing of Windows. So when I do it, I put my Move and Resize actions into a loop so that the Move and Resize action occurs over and over again until the location and size of the window matches the values that I'm trying to set them to. This creates a cute animation effect, which I really like. Which version of macOS are you currently using? That may impact the solution required.
Here's how I do it, in pseudo code...
While the current window is not the correct size and location
Call the Resize window action to set it to the correct location
End while
I searched for a hidden setting that impacts the Move and Resize action. I can't find it, but if it were documented, it's probably on this page:
Thank you. I’m running the latest version of Tahoe.
I am intrigued by your pseudo code solution. How can I verify that the current window is not the correct size and location? Please refer to the screenshot of my macro above for a use case.
I think I should point out first that both of us seemed to have misunderstood one of Peter's points. When he wrote, "if you turn them off," the word "it" wasn't referring to "delays" but rather the earlier word "animations." So your follow up question "How do I turn default delays on and off" reflected that misinterpretation.
I will address your other question in a few minutes.
Your screenshot is a pretty weak example to be demonstrating, since none of your values are anything other than "full screen." In fact, your example is slightly flawed because the string "*100%" does nothing at all.
There is a macOS shortcut to make a window go full screen (specifically, "best fit", which is a special variation of full screen), and you don't need KM for that at all. It's CTRL-GLOBE-F. That will do exactly what you are trying to do, in your example macro above.
I will write you some code that addresses your question, but first I wanted to point out above that there's no reason for any code in this example because macOS already solves that specific "use case" for you.
Here is some code to demonstrate "how to verify if the current window is in the correct size and location." The green actions are actions that you will need to use. The orange actions are actions that I placed into this macro to demonstrate how the macro works in a beautiful way. I've already forgotten how to enable window animations on macOS, but this macro that I've written will work whether or not you have animations enabled.
This macro demonstrates how to ensure that a window is correctly moved and resized. If the window is not correctly moved or resized, it will redo the move/resize over and over until it's properly moved and resized.
In general, one should never assume that an action worked, especially when such actions deal with unpredictable things. It's always best to validate and re-do any action that has a chance to fail. That's what this macro does.
If it was that simple, I would do it in Keyboard Maestro that way.
The reported size of the window, while it is animating, is the end result. But if you set the size or position while it is animating, then it will cancel the animation where it is.
Hmm, I didn't know that. So why not just turn off the window animation here (see image below.) From what I can see, I've had the "reduce motion" flag on for years, which may be why my macro worked, when you seem to think it shouldn't work.