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


Click here to return to the '10.4: Use Automator to open chosen folder in Terminal' hint
The following comments are owned by whoever posted them. This site is not responsible for what they say.
10.4: Use Automator to open chosen folder in Terminal
Authored by: dkulp on Jan 25, '06 11:36:34AM
I want to right click on a folder or a file. If a file then it should open the terminal in the enclosing folder.


on run {input, parameters}
	
	tell application "Terminal"
		activate
		set p to (quoted form of POSIX path of (input as string))
		set s to "if [ -d " & p & " ]; then cd " & p & "; else cd `dirname " & p & "`; fi"
		if (the (count of the window) = 0) or (the busy of window 1 = true) then
			do script s
		else
			do script s in window 1
		end if
	end tell
	return input
end run


[ Reply to This | # ]