Last active
September 15, 2020 15:31
-
-
Save nikolay-n/5b57ee09f555c873624a275920fd55d4 to your computer and use it in GitHub Desktop.
Open iTerm or Terminal with current Finder path
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
Launch Automator and select Application, add "Run AppleScript" action and paste code from TermLaunch.scpt, save app as TermLaunch. | |
You can replace icon /Path/To/TermLaunch.app/Contents/Resources/AutomatorApplet.icns to | |
/Applications/Utilities/Terminal.app/Contents/Resources/Terminal.icns for example | |
Use Cmd + Drag to place app on Finder toolbar |
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) | |
set fPath to (quoted form of finderPath()) | |
-- Trying iTerm app | |
set itermPath to do shell script "mdfind 'kMDItemCFBundleIdentifier == com.googlecode.iterm*'" | |
if itermPath is not "" then | |
do shell script "open -a iTerm " & fPath | |
return | |
end if | |
-- Trying terminal app | |
do shell script "open -a Terminal " & fPath | |
end run | |
on finderPath() | |
tell application "Finder" | |
set currentPath to the POSIX path of (target of window 1 as alias) | |
end tell | |
return currentPath | |
end finderPath |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment