// An applescript that resizes the front two windows of the active application side by side, filling the screen.
1
2 -- An applescript that resizes the front two windows of the active application side by side, filling the screen.
3 -- Written by Simon Dorfman, January 4, 2006. www.SimonDorfman.com
4
5 -- Save this script to ~/Library/Scripts/Applications/Run from QuickSilver Triggers, Don't move these/Front 2 Windows Side by Side - Control + Option + C.scpt
6 -- I use keyboard shortcut Control + Option + C to run it. I think of the C as standing for "Compare".
7 -- You'll need to have "Enable access for assisstive devices" enabled under Universal Access in System Preferences.
8
9 --set screen dimension variables
10 set menubarHeight to 22
11 set screenWidth to word 3 of (do shell script "defaults read /Library/Preferences/com.apple.windowserver | grep -w Width") as number
12 set screenHeight to word 3 of (do shell script "defaults read /Library/Preferences/com.apple.windowserver | grep -w Height") as number
13 --if you plan to use this on just one computer where the screen dimensions won't change, this script will run faster if you just hard code your screen resolution with these two lines:
14 --set screenWidth to 1280
15 --set screenHeight to 854
16 {screenWidth, screenHeight}
17
18 tell application "System Events"
19 set frontApp to name of first application process whose frontmost is true
20 end tell
21
22 --some apps are wacky and put the windows higher for some reason, adjust for this bug.
23 if (frontApp is equal to "Finder" or frontApp is equal to "Microsoft Entourage") then
24 set menubarHeight to 44
25 end if
26 --leave room for the Excel Toolbar
27 if (frontApp is equal to "Microsoft Excel") then
28 set menubarHeight to 55
29 end if
30
31 try
32 tell application frontApp
33 set bounds of window 1 to {0, menubarHeight, (screenWidth / 2), screenHeight}
34 set bounds of window 2 to {(screenWidth / 2), menubarHeight, screenWidth, screenHeight}
35 end tell
36 on error the error_message number the error_number
37 display dialog "Error: " & the error_number & ". " & the error_message buttons {"OK"} default button 1
38 end try