1 Reply
      Latest reply on Apr 9, 2020 1:16 AM by juandesant
      MasterMaps Level 1 Level 1 (0 points)

        How can I maximize the Safari application window using JXA?

        • Re: How to maximize Safari window with JavaScript for Automation (JXA)?
          juandesant Level 1 Level 1 (0 points)

          This is an AppleScript that does what you want:

           

          tell first window of application "Safari"

            set isZoomable to zoomable

            if isZoomable then

            set zoomedAtFirst to zoomed

            set theBounds to the bounds

           

            copy theBounds to theNewBounds

            set the third item of theNewBounds to ((first item of theBounds) + 512)

            set the fourth item of theNewBounds to ((second item of theBounds) + 384)

           

            set bounds to theNewBounds

            set zoomed to false

            set zoomed to true

            copy bounds to theFinalBounds

            set zoomedAtLast to zoomed

            set theVars to {zoomedAtFirst, theBounds, theNewBounds, theFinalBounds}

            end if

            get theVars

          end tell