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


Click here to return to the 'Terminal.app' hint
The following comments are owned by whoever posted them. This site is not responsible for what they say.
Terminal.app
Authored by: ptman on Nov 27, '07 06:04:15AM
Hi, I'm using Leopard and trying to make an applescript that tiles my terminal windows. I can't get this working. For some reason, even if event log shows that I'm giving the right set bounds -commands, the windows all keep to the top, right below the menu bar. Make sure you test this with enough terminal windows, I have a small screen so 3-5 are enough.

tell application "Finder"
	set {desktopLeft, desktopTop, desktopRight, desktopBottom} to bounds of window of desktop
	set screenWidth to desktopRight - desktopLeft
	set screenHeight to desktopBottom - desktopTop - 22 -- menu
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 screenHeight to screenHeight - (dockTileSize + 18)
else
	set screenWidth to screenWidth - (dockTileSize + 18)
end if
log "screenHeight: " & screenHeight & " screenWidth: " & screenWidth

tell application "Terminal"
	set windowWidth to 490 -- 80x24 terminal with monaco 10pt minus the scrollBar
	set windowHeight to 368 -- 80x24 terminal with monaco 10pt
	
	set perRow to screenWidth div windowWidth
	set perColumn to screenHeight div windowHeight
	set theWindows to (every window where visible is true)
	
	repeat with theIndex from 1 to count of theWindows
		set theWindow to item theIndex of theWindows
		set realIndex to theIndex - 1
		set theColumn to realIndex mod perRow
		set theRow to (realIndex div perRow) mod perColumn
		set windowLeft to theColumn * windowWidth
		set windowTop to theRow * windowHeight
		log "theColumn: " & theColumn & " theRow: " & theRow
		set bounds of theWindow to {windowLeft, windowTop, windowLeft + windowWidth + 16, windowTop + windowHeight}
	end repeat
end tell


[ Reply to This | # ]