I noticed that in OS X, the “zoom” option toggles a window between larger and smaller. I need a macro to make it larger via zoom, unless it is already larger in which case do nothing. I am new to OS X and having trouble finding directions for doing this even using OS X manually – I can find references to setting up a keyboard shortcut for the TOGGLE action of zoom, but not something that ONLY maximizes.
To take a step back and ask why I am doing this, it is because I am trying to record macros with mouse clicks and I want to be sure the layout of the app’s window is in a consistent state before running the recorded macro. If there is a better way to do this, let me know.
.
Interesting question from mike1127.
I, too, use OSX zoom function.
OSX hot keys are in Apple menu / System Preferences / Accessibility / Zoom
You don't need KM to use those, but KM will make it easier.
To get consistent magnification each time, use KM action, "repeat", and specify something like: zoom-in 5 times.
I hope this is helpful to you.
Anything not clear, please don't be shy to ask.
.
The Keyboard Maestro “Zoom” action does an accessibility press on the kAXZoomButtonAttribute, which is basically the same as clicking the green button in the window, which used to zoom to full size, but Apple changed to do Enter Full Screen.
I find it difficult to change this “Zoom” action name to “Enter Full Screen” while performing the accessibility action on the kAXZoomButtonAttribute and I don’t know what Apple might do next week.
The Full Screen window resize resizes to the full available screen area, it is not related to Full Screen Mode in the same way that you cannot manually resize a window to Full Screen Mode.
Probably not, but the green button has two accessibility actions: AXPress (= full screen) and AXZoomWindow (= zoom).
This does the same as a single click:
tell application "System Events"
tell (first application process whose frontmost is true)
tell front window
tell (first button whose subrole is "AXFullScreenButton") --button 2
perform action "AXPress"
end tell
end tell
end tell
end tell
This does the same as an Option-click:
tell application "System Events"
tell (first application process whose frontmost is true)
tell front window
tell (first button whose subrole is "AXFullScreenButton") --button 2
perform action "AXZoomWindow"
end tell
end tell
end tell
end tell
But my initial comment wasn’t about the functionality of the KM action, it was just about the naming Zoom vs Full Screen.
The option-click AppleScript didn't work for me in Monterey. This did:
tell application "System Events"
perform action "AXZoomWindow" of (first button whose subrole is "AXFullScreenButton") of (first window whose subrole is "AXStandardWindow") of (first process whose frontmost is true)
end tell
and for narrower display one might be tempted to turn that inside out:
tell application "System Events"
tell (first process whose frontmost is true)
tell (first window whose subrole is "AXStandardWindow")
tell (first button whose subrole is "AXFullScreenButton")
perform action "AXZoomWindow"
end tell
end tell
end tell
end tell