Submit Hint Search The Forums LinksStatsPollsHeadlinesRSS
14,000 hints and counting!


Click here to return to the 'Create identical tiled windows in most apps via AppleScript' hint
The following comments are owned by whoever posted them. This site is not responsible for what they say.
Create identical tiled windows in most apps via AppleScript
Authored by: spheare on Jun 21, '07 04:54:57AM
The script actually cascades the windows. I modified it to tile all windows of an application horizontally across the screen so you can see them all at once.

-- ADJUST THIS TO YOUR LIKING
property spacing : 10

-- DO NOT TOUCH BELOW HERE
tell application "Finder"
	set screenSize to bounds of window of desktop
	set availScreenWidth to item 3 of screenSize
	set availScreenHeight to item 4 of screenSize
end tell

tell application "System Events"
	set dockProps to property list file "~/Library/Preferences/com.apple.dock.plist"
	set dockSide to the value of the property list item "orientation" of dockProps
	set dockTileSize to the value of the property list item "tilesize" of dockProps
end tell
if dockSide is "bottom" then
	set availScreenHeight to availScreenHeight - (dockTileSize + 10)
end if
tell application "System Events"
	set myFrontMost to name of first item of (processes whose frontmost is true)
end tell

if myFrontMost is "Finder" then
	set myTopCorr to 44
else
	set myTopCorr to 22
end if
try
	tell application myFrontMost
		set allWindows to (every window where visible is true)
		set n to count of allWindows
		set nSpacingWidth to (n + 1) * spacing
		set nWindowWidth to (availScreenWidth - nSpacingWidth) / n
		repeat with x from 1 to n
			tell window x
				set nLeft to (x * spacing) + (x - 1) * nWindowWidth
				set bounds to {¬
					nLeft, ¬
					myTopCorr + spacing, ¬
					nLeft + nWindowWidth, ¬
					availScreenHeight - spacing}
			end tell
		end repeat
	end tell
on error the error_message number the error_number
	display dialog "Error: " & the error_number & ". " & the error_message buttons {"OK"} default button 1
end try



[ Reply to This | # ]