iEnno Posted March 31, 2013 Share Posted March 31, 2013 (edited) So here's a workflow to open the current Finder window in Terminal or iTerm, depending on what you like to stick with. Also the other way round is possible. ft: open current Finder directory in Terminal tf: open current Terminal directory in Finder fi: open current Finder directory in iTerm if: open current iTerm directory in Finder For Path Finder fans: pt: open current Path Finder directory in Terminal tp: open current Terminal directory in Path Finder pi: open current Path Finder directory in iTerm ip: open current iTerm directory in Path Finder GitHub. Direct Download. Edited September 22, 2014 by iEnno elliotstoner, Sridhar Katakam, Colin and 6 others 9 Link to comment
cmsj Posted April 5, 2013 Share Posted April 5, 2013 Very nice. I find that ft seems to match FaceTime more than this plugin, I'd consider it suitable for a hotkey to go finder->terminal. Link to comment
raguay.customct Posted April 5, 2013 Share Posted April 5, 2013 Very nice. I find that ft seems to match FaceTime more than this plugin, I'd consider it suitable for a hotkey to go finder->terminal. Just scroll to it and execute it several times. Then Alfred will put it at the top of the list due to number of times selected. Very useful feature! Link to comment
lmartins Posted April 5, 2013 Share Posted April 5, 2013 Is there any way to make it open in a new terminal tab instead of a new window? Link to comment
ramiro.araujo Posted April 6, 2013 Share Posted April 6, 2013 Nice one! Keep in mind you can also do "open ." in terminal or iTerm and open it's current path in Finder Link to comment
twinpeaks Posted April 6, 2013 Share Posted April 6, 2013 Found this on Github, very nice and easy to use. Really like it. Link to comment
iEnno Posted April 6, 2013 Author Share Posted April 6, 2013 Is there any way to make it open in a new terminal tab instead of a new window? Will have a look into, thanks for suggestion. Nice one! Keep in mind you can also do "open ." in terminal or iTerm and open it's current path in Finder Well, that's exactly what the script does. It's just the Alfred way Found this on Github, very nice and easy to use. Really like it. Thanks, man. Always nice to hear that something I built for myself is helpful to others. Really appreciate it. Link to comment
franzheidl Posted April 6, 2013 Share Posted April 6, 2013 New Tab should be fairly easy to do, if you're not afraid of (or generally opposed to) GUI scripting with AppleScript that is tell application "Terminal" activate tell application "System Events" to tell process "Terminal" to keystroke "t" using command down end tell Should work identically for iTerm as it uses the same shortcut for new Tab. I don't think there's another way since neither Terminal.app nor iTerm directly expose Tabs to AppleScript AFAIK. Link to comment
iEnno Posted April 6, 2013 Author Share Posted April 6, 2013 For me iTerm opens a new Tab. Terminal doesn't. Maybe there is a setting to globally open new windows as new tabs. If not, sticking with franzheidl's AppleScript should be doing the job. Link to comment
lmartins Posted April 6, 2013 Share Posted April 6, 2013 Ok, thanks, i'll try to experiment a bit with that. Link to comment
Subject22 Posted April 12, 2013 Share Posted April 12, 2013 (edited) Handy workflow! I made a context aware equivalent triggered by a hotkey. If you're in Finder when you use it it'll open the current directory in Terminal, if you're in Terminal when you use it it'll open the current directory in Finder. I didn't bother including iTerm as I never use it. I'm sure that anyone who's using this kind of workflow will be more than capable of adding support for iTerm, should they need it :-) I'd appreciate any critiques of the AppleScript code I wrote. It's fairly messy, but anything neater (in terms of code) was less robust in actual use. Download: Directory Switcher Edited June 10, 2013 by Subject22 spencermountain and twinpeaks 2 Link to comment
spencermountain Posted November 13, 2013 Share Posted November 13, 2013 (edited) so goooood...... thank you!forked 'directory switcher' to use "Path Finder" instead of "Finder"https://www.dropbox.com/s/nz4ij0e00jnf3np/Path%20Finder%20Directory%20Switcher.alfredworkflow Edited November 13, 2013 by spencermountain Link to comment
MagisDing Posted December 4, 2013 Share Posted December 4, 2013 Great workflow, thanks for sharing! Link to comment
iEnno Posted December 4, 2013 Author Share Posted December 4, 2013 Great workflow, thanks for sharing! Glad you find it useful, thx for your feedback. Link to comment
politicus Posted September 17, 2014 Share Posted September 17, 2014 @iEnno I am trying to create a workflow to open iTerm current directory in ForkLift. My question in the Help section of the forum. Any idea how I could do it? Thank you. Link to comment
iEnno Posted September 17, 2014 Author Share Posted September 17, 2014 @politicus: ForKlift is a hard one, because neither does it support AppleScript nor does it work with the standard "open" command in terminal. I found this and managed to get it work by triggering the following AppleScript: on alfred_script(q) tell application "iTerm" tell the current session of current terminal write text "absPath=`pwd` (cat<<EOF if application \"ForkLift\" is not running then activate application \"ForkLift\" delay 1 end if activate application \"ForkLift\" tell application \"System Events\" keystroke \"g\" using {command down, shift down} keystroke \"$absPath\" keystroke return end tell EOF ) | osascript" end tell end tell end alfred_script Try it yourself and tell me if that works for you. Link to comment
politicus Posted September 17, 2014 Share Posted September 17, 2014 It is not working. No error. All I have is iTerm processes the script. Forklift becomes the frontmost application. I hear a weird noise. That's all. Link to comment
politicus Posted September 19, 2014 Share Posted September 19, 2014 @iEnno Alright, so I've found the solution... with Keyboard Maestro. I just attached a keyboard shortcut to an insert text action. When I press Ctrl+T it writes "open -a 'Path Finder' ./" in iTerm and hit enter. Problem solved Thanks for your help. Link to comment
iEnno Posted September 22, 2014 Author Share Posted September 22, 2014 When I press Ctrl+T it writes "open -a 'Path Finder' ./" in iTerm and hit enter. If I knew Path Finder was also an option I would have just sugested using the keyword ip. It will open the current iTerm directory in Path Finder thanks to a user contribution on github. I will update the initial post to state this clear. Nevertheless Keyboard Maestro seems like a good fit for this. You could also use TextExpander which I use for common terminal commands. There are many ways to achieve your goal, so I'm glaf you found yours Link to comment
politicus Posted September 22, 2014 Share Posted September 22, 2014 Keyboard Maestro is a great app but the developer doesn't know how to copy the iTerm current directory to the clipboard... I wish there was an Keyboard Maestro action for it. Link to comment
vitor Posted January 1, 2016 Share Posted January 1, 2016 Hello miromann, It’s not good form to hijack the thread to publicise your workflow, particularly with dubious claims. It would be one thing if someone had mentioned something they were missing from this workflow and you had one that filled the user’s need, but that does not seem to be the case at all, here.I’ve tried your workflow, and didn’t find it any any faster (not noticeably, anyway) and it didn’t seem to work as robustly (never worked at opening in my Finder window), be as well put together (pressing ⌥ has a blank message), and it doesn’t do as much (PathFinder support, for example, or opening terminal’s current directory in Finder, as well as the reverse).All of those are fixable, though, and would be better discussed in their own thread. You should start your own post, as that would even give better visibility to your workflow. deanishe and iEnno 2 Link to comment
Colin Posted November 3, 2017 Share Posted November 3, 2017 I know this is an old post but.... Very very nice. I like it. Now I do not have to type long-winded paths to get to the directory I want. Link to comment
Siraj Samsudeen Posted March 22, 2021 Share Posted March 22, 2021 Thank you so much for this simple, but beautiful workflow. Link to comment
forgetfulfellow Posted July 20, 2021 Share Posted July 20, 2021 I was able to easily create a Finder -> VS Code addition by just replacing "Sublime Text" with "Visual Studio Code" inside the applescript file! Thanks @iEnno! ! Link to comment
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now