Last active
December 21, 2019 09:22
-
-
Save emaysyuk/5f7a6f3e81e8611bc3261975eb0d8b88 to your computer and use it in GitHub Desktop.
Automator script that opens iTerm in current folder (script can be binded to macOS 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, parameters} | |
tell application "Finder" | |
set dir to quoted form of (POSIX path of (folder of the front window as alias)) | |
if application "iTerm" is running then | |
tell application "iTerm" | |
tell current window | |
create tab with default profile | |
end tell | |
tell current session of current window | |
write text "cd " & dir & "&& clear" | |
end tell | |
activate | |
end tell | |
else | |
tell application "iTerm" | |
tell current session of current window | |
write text "cd " & dir & "&& clear" | |
end tell | |
activate | |
end tell | |
end if | |
end tell | |
return input | |
end run |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment