topfunky / osx-window-sizing forked from wycats/osx-window-sizing

AppleScripts to resize windows simply

This URL has Read+Write access

osx-window-sizing / front-half-left.applescript
100644 26 lines (18 sloc) 0.763 kb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
-- AUTHOR: Geoffrey Grosenbach http://peepcode.com
 
-- Put frontmost window on left half
 
-- Works with most setups
tell application "Finder"
  set {screen_left, screen_top, screen_width, screen_height} to bounds of window of desktop
end tell
 
-- NOTE This may work better with some multi-monitor setups
-- tell application "Safari"
-- set screen_width to (do JavaScript "screen.availWidth" in document 1)
-- set screen_height to (do JavaScript "screen.availHeight" in document 1)
-- end tell
 
tell application "System Events"
 
  set myFrontMost to name of first item of (processes whose frontmost is true)
 
  tell process myFrontMost
    set size of window 1 to {(screen_width/2), screen_height}
    set position of window 1 to {0, 20}
  end tell
 
end tell