From edf1eea0a4ec31d7e4d38a4a7de6bafef379dfd4 Mon Sep 17 00:00:00 2001 From: Geoffrey Grosenbach Date: Fri, 13 Jun 2008 22:58:58 -0700 Subject: [PATCH] Use screen-sensitive sizing, with Safari measurements --- center.applescript | 8 ++++++-- front-half-left.applescript | 17 +++++++++++++++-- front-half-right.applescript | 19 ++++++++++++++++--- front-natural-left.applescript | 13 +++++++++++-- 4 files changed, 48 insertions(+), 9 deletions(-) diff --git a/center.applescript b/center.applescript index 346b590..27f91ca 100644 --- a/center.applescript +++ b/center.applescript @@ -1,4 +1,4 @@ -set windowWidth to 800 +set windowWidth to 1000 set windowHeight to 600 delay 0.1 @@ -51,4 +51,8 @@ tell application "System Events" set position of window 1 to {((screen_width - windowWidth - w) / 2), ((screen_height - windowHeight) / 2.0) - desktopTop} set size of window 1 to {windowWidth, windowHeight} end tell -end tell \ No newline at end of file +end tell + +tell application "Safari" + quit +end tell diff --git a/front-half-left.applescript b/front-half-left.applescript index e21a421..a326bd2 100644 --- a/front-half-left.applescript +++ b/front-half-left.applescript @@ -1,12 +1,25 @@ -- Put frontmost window on left half +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 "Finder" +-- set {desktopTop, desktopLeft, desktopRight, desktopBottom} to bounds of desktop +-- 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 {840, 1040} + set size of window 1 to {(screen_width/2), screen_height} set position of window 1 to {0, 20} end tell -end tell \ No newline at end of file +end tell + +tell application "Safari" + quit +end tell diff --git a/front-half-right.applescript b/front-half-right.applescript index 864ffda..18f845b 100644 --- a/front-half-right.applescript +++ b/front-half-right.applescript @@ -1,12 +1,25 @@ -- Put frontmost window on right half +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 "Finder" +-- set {desktopTop, desktopLeft, desktopRight, desktopBottom} to bounds of desktop +-- 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 {840, 1040} - set position of window 1 to {840, 20} + set size of window 1 to {(screen_width/2), screen_height} + set position of window 1 to {(screen_width/2), 20} end tell -end tell \ No newline at end of file +end tell + +tell application "Safari" + quit +end tell diff --git a/front-natural-left.applescript b/front-natural-left.applescript index ddfa404..b280156 100644 --- a/front-natural-left.applescript +++ b/front-natural-left.applescript @@ -1,12 +1,21 @@ -- Put frontmost window on left side +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 {1040, 1040} + set size of window 1 to {1040, screen_height} set position of window 1 to {0, 20} end tell -end tell \ No newline at end of file +end tell + +tell application "Safari" + quit +end tell