Resize mac window to the left/right half of the screen

pihao
2014-06-21T01:55:23Z

resize-mac-window.scpt

| (* Get screen size *)
| tell application "Finder"
| set screenSize to bounds of window of desktop
| set screenW to item 3 of screenSize
| set screenH to item 4 of screenSize
| end tell
|
| (* Get front most window *)
| tell application "System Events"
| set myFrontmost to name of first item of (processes whose frontmost is true)
| end tell
|
| (* set front most windown size by screen size *)
| try
| tell application myFrontmost
| (*set bounds of window 1 to {0, 0, screenW / 2.0, screenH}*)
| set bounds of window 1 to {screenW / 2.0, 0, screenW, screenH}
| end tell
| end try