Skip to content

Instantly share code, notes, and snippets.

@guiwuff
Last active April 16, 2017 02:02
Show Gist options
  • Save guiwuff/f99b4815785bbd8a4a5cd4d11e90fa63 to your computer and use it in GitHub Desktop.
Save guiwuff/f99b4815785bbd8a4a5cd4d11e90fa63 to your computer and use it in GitHub Desktop.
open iTerm from Finder toolbar using Automator App
# Reference : https://gist.github.com/pdanford/158d74e2026f393e953ed43ff8168ec1
# Open Automator -> Application -> Action -> Run Apple Script
on run {input, parameters}
tell application "Finder"
set dir_path to quoted form of (POSIX path of (folder of the front window as alias))
end tell
CD_to(dir_path)
end run
on CD_to(theDir)
tell application "iTerm"
activate
set win to (create window with default profile)
set sesh to (current session of win)
tell sesh to write text "cd " & theDir & ";clear"
end tell
end CD_to
# Save as : iTermOpenScript.app, view the app in finder, drag & drop to the Finder toolbar
# Replace the icon by accessing get info of the app file
# Open /Applications/iTerm.app/Contents/Resources/Appicon.icns in your image viewer / preview, Select All and Paste into Get Info dialog window.
@guiwuff
Copy link
Author

guiwuff commented Apr 16, 2017

Screenshot

screen shot 2017-04-16 at 08 58 48

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment