Last active
December 27, 2015 08:59
-
-
Save panlw/7300338 to your computer and use it in GitHub Desktop.
[Finder] Start iTerm Here
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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