How to size (or resize) application windows in AppleScript

AppleScript FAQ: How can I size or resize an application window using AppleScript?

To resize an application window with AppleScript, use a command like this:

tell application "Safari"
    set bounds of front window to {300, 30, 1200, 900}
end tell

That command tells the Safari browser to have the following size and location properties:

  • x = 300
  • y = 30
  • width = 1200
  • height = 900

When using this command, x and y correspond to the desired location of the application window, and those values represent where you want the upper-left corner of the window to be located.

I just used that code in a little script, and I can confirm that it works properly.