Skip to content

Instantly share code, notes, and snippets.

@panlw
Last active December 27, 2015 08:59
Show Gist options
  • Save panlw/7300338 to your computer and use it in GitHub Desktop.
Save panlw/7300338 to your computer and use it in GitHub Desktop.
[Finder] Start iTerm Here
on run {input, parameters}
tell application "Finder"
set dirPath to "\"" & (POSIX path of (input as string)) & "\""
end tell
CdTo(dirPath)
end run
on CdTo(theDir)
tell application "iTerm"
activate
try
set t to the last terminal
on error
set t to (make new terminal)
end try
tell t
launch session "Default Session"
tell the last session
write text "cd " & theDir & ";clear;ls"
end tell
end tell
end tell
end CdTo
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment