Skip to content

Instantly share code, notes, and snippets.

@robsonke
Created August 28, 2014 08:37
Show Gist options
  • Save robsonke/eded13bea58b505682e8 to your computer and use it in GitHub Desktop.
Save robsonke/eded13bea58b505682e8 to your computer and use it in GitHub Desktop.
-- Modified script, based on:
-- http://peterdowns.com/posts/open-iterm-finder-service.html
on run {input, parameters}
tell application "Finder"
set dir_path to quoted form of (POSIX path of (folder of the front window as alias))
end tell
CD_to(dir_path)
end run
on CD_to(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
write text "ls"
end tell
end tell
end tell
end CD_to
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment