Resize Any Window Quickly and Exactly With AppleScript and FastScripts
If your watching a movie or just need to focus your attention completely on a single task, maximizing your applications to full-screen is the way to go. Most of the time, however, having applications maximized in this way is overkill and a waste of screen real estate. Apple apparently felt the same way when creating the functionality for their ‘window management’ buttons visible in the upper left corner of most Mac apps. The red one closes the window, the orange minimizes, but contrary to what one might expect, the green button does not maximize the window to full-screen. Rather, it resizes it smartly and makes the window no bigger than the content it presents requires (and because of this, the green button will make the window smaller in some cases). You can give this a try right now if you’re in Safari. The green button will set Safari’s width to 950 pixels - exactly the width of Mac Membrane.![]()
But I’ve never been entirely convinced by the little green button. It can be difficult to predict exactly how pressing it will resize some windows, and occasionally, full-screen, regardless of what is being displayed in the application window, is exactly what I am after. Here is the fine-grained and keyboard friendly solution that I’ve hit upon.
Open up Script Editor (in Applications >> AppleScript >> Script Editor) and paste in the following code:
set front_app to (path to frontmost application as Unicode text)
tell application front_app
activate
set bounds of window 1 to {160, 80, 980, 700}
end tell
Hit compile and run it and your Script Editor window should resize to a slightly off-center 820 x 620 pane (I’ll refer to this size as ‘Small’). While these may not be the ideal dimensions for an AppleScript Editor window, they are the perfect size for reading the majority of online blogs. Here are a few more of my favorites:
{170, 70, 1170, 780}
Medium: 1000 x 710 for wide aspect blogs or websites.
{80, 50, 1360, 860}
Large: Full-screen for a MacBook.
{1, 30, 1440, 9000}
Full: Full-screen for a 15 inch MacBook Pro.
Play around with the values listed above to find the window sizes that suit your needs and save the ones you like to Users >> your-user-name >> Library >> Scripts. Once saved in your script folder, your new resize scripts will be accessible to you system-wide via your master script list in your Mac’s menu bar (if you don’t see the AppleScript icon in your menu bar, open AppleScript Utility - Applications >> AppleScript >> AppleScript Utility - and check the box “Show Script menu in menu bar”).
FastScripts Lite is an alternative to the built-in AppleScript menu and allows you to add triggers (or keyboard shortcuts) to any script in your library. I have my resize scripts mapped to Command + control + J,K,L,; for Small, Medium, Large and Full respectively, but you can choose anything you like. With these hot keys defined (FastScripts makes doing so really easy) you can now quickly and conveniently resize almost any window on your Mac.
FastScripts Lite is available as freeware from Red Sweater Software (scroll down to the bottom of the page). FastScripts proper, which lets you set unlimited keyboard shortcuts for scripts (you’re limited to 10 with the free version) and has some other excellent features, costs 14.95 US.
