Applescript to click green (zoom) button with Option down

Solution 1:

You can use one of the actions of the "AXFullScreenButton":

  • "AXZoomWindow" action to maximize.
  • "AXPress" action to full screen.

Use the perform action command, like this.

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