|
|
Tile Safari windows via AppleScript
Factors in Downloads and Source, less redundant : ). Still need a better way to determine the download window. Leads thus far are:
1- It's window id is constant unless Safari is restarted. 2- It's document field is blank. tell application "Safari" -- For some reason Safari has (two) invisible windows set allWindows to (every window where visible is true) set n to count of allWindows set goodWindows to {} -- Might run into problems with actual websites titled "Downloads", open for suggestions a more perfect solution : ) repeat with x from 1 to n set windowX to item x of allWindows if ((name of windowX does not contain "Source of http://") and (name of windowX is not "Downloads")) then set goodWindows to goodWindows & {windowX} end if end repeat set n to count of goodWindows if n is 0 then return -- Dividing by zero is bad -- Get dock position set dock to do shell script "defaults read com.apple.dock orientation" -- Get actual width of screen to help with left-side docks tell application "Finder" set screenSize to bounds of window of desktop set actualWidth to item 3 of screenSize end tell -- Determine space open on your screen, factoring in the Dock set screenWidth to do JavaScript "screen.availWidth" in document 1 set screenHeight to do JavaScript "screen.availHeight" in document 1 -- Get dock size set dockSize to actualWidth - screenWidth -- Get rid of 4 pixel buffer on Dock if dockSize is 4 then set dockSize to 0 end if -- Determine each window's width set windowWidth to (screenWidth / n) -- Position each window in turn repeat with x from 1 to n tell item x of goodWindows set index to 1 --Makes sure the Source and Downloads windows are behind the tiled ones if (dock is not equal to "left") then set bounds to {windowWidth * (x - 1), 21, windowWidth * x, screenHeight} -- 21 is the size of the Menu Bar (for 10.4 at least) else set bounds to {windowWidth * (x - 1) + dockSize, 21, windowWidth * x + dockSize, screenHeight} end if end tell end repeat end tell
Tile Safari windows via AppleScript
"-- Might run into problems with actual websites titled "Downloads", open for suggestions a more perfect solution : )" |
SearchFrom our Sponsor...Latest Mountain Lion HintsWhat's New:HintsNo new hintsComments last 2 daysNo new commentsLinks last 2 weeksNo recent new linksWhat's New in the Forums?
Hints by TopicNews from Macworld
From Our Sponsors |
|
Copyright © 2014 IDG Consumer & SMB (Privacy Policy) Contact Us All trademarks and copyrights on this page are owned by their respective owners. |
Visit other IDG sites: |
|
|
|
Created this page in 0.09 seconds |
|