Created
August 31, 2014 10:37
-
-
Save cmittendorf/415afb4ac880acce7f3e to your computer and use it in GitHub Desktop.
Open a Terminal window with the front Finder window as path.
This file contains hidden or 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 | |
tell application "Finder" | |
activate | |
try | |
set this_folder to (the target of the front window) as alias | |
on error | |
set this_folder to startup disk | |
end try | |
my open_terminal_window(this_folder) | |
end tell | |
tell application "Terminal" | |
activate | |
end tell | |
end run | |
on open finder_items | |
repeat with this_item in finder_items | |
my open_terminal_window(this_item) | |
end repeat | |
end open | |
on open_terminal_window(finder_item) | |
set path_to_open to POSIX path of finder_item | |
repeat until path_to_open ends with "/" | |
set path_to_open to text 1 thru -2 of path_to_open | |
end repeat | |
tell application "Terminal" | |
do script with command "cd " & quoted form of path_to_open | |
end tell | |
end open_terminal_window |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment