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


Click here to return to the '10.5: Fix a Terminal window position AppleScript issue' hint
The following comments are owned by whoever posted them. This site is not responsible for what they say.
10.5: Fix a Terminal window position AppleScript issue
Authored by: yee379 on Dec 16, '08 04:30:54PM
Hi, i've been looking for a solution like this for a while! thanks! however, in order to support all windows ('cept firefox), i use an applescript to move window around - i wrap it around Spark to enable keyboard shortcuts. (of course there are specific ones for each direction)

set cur_app to (path to frontmost application as Unicode text)
set xoffset to 45

tell application cur_app
	tell front window
		set {x1, y1, x2, y2} to (get bounds)
	end tell
	set x1 to (x1 + xoffset)
	set x2 to (x2 + xoffset)
	if cur_app contains "Terminal.app" then
		set w to x2 - x1
		set h to y2 - y1
		set positionScript to "echo -en '\\E[3;'" & x1 & "';'" & y1 & "'t'"
		set positionScript to positionScript & ";echo -en '\\E[4;'" & h & "';'" & w & "'t'"
		tell application "Terminal"
			do script positionScript
		end tell
	else
		tell front window
			set bounds to {x1, y1, x2, y2}
		end tell
	end if
end tell
the problem is, because it's a 'do script ...' it opens up a new terminal window each time... does anyone know how i can adapt my script so that it doesn't open a new terminal window each time? (i was thinking it could automatically type the commands in...) cheers!

[ Reply to This | # ]