Skip to content

Instantly share code, notes, and snippets.

@sandrods
Created October 7, 2009 18:48
Show Gist options
  • Select an option

  • Save sandrods/204309 to your computer and use it in GitHub Desktop.

Select an option

Save sandrods/204309 to your computer and use it in GitHub Desktop.
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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment