Last active
July 6, 2019 09:25
-
-
Save brandonpittman/5625691 to your computer and use it in GitHub Desktop.
AppleScript to switch to the current Finder directory while navigating the command line. Run as a TextExpander snippet (set to "AppleScript") for maximum utility.
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
tell application "System Events" | |
tell process "Finder" | |
if window 1 exists then | |
tell application "Finder" | |
set thePath to get quoted form of POSIX path of (target of front Finder window as text) | |
return "cd " & thePath & return | |
end tell | |
else | |
display alert "Finder doesn't have a window open." as warning giving up after 2 | |
end if | |
end tell | |
end tell |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment