Skip to content

Instantly share code, notes, and snippets.

@brandonpittman
Last active July 6, 2019 09:25
Show Gist options
  • Save brandonpittman/5625691 to your computer and use it in GitHub Desktop.
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.
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