Submit Hint Search The Forums LinksStatsPollsHeadlinesRSS
14,000 hints and counting!


Click here to return to the 'Command-drag to Terminal to change directory ' hint
The following comments are owned by whoever posted them. This site is not responsible for what they say.
Command-drag to Terminal to change directory
Authored by: ccstone on Aug 27, '12 10:33:49PM

Nice hint. I'll use it now and then.

Option-Drag puts the correctly escaped path of the dragged item(s) into the Terminal.

To get to the open Finder window I normally run the following script via hotkey from FastScripts with the Terminal as the active app. It will open a new tab if the current one is busy.

-ccs

try
  
  tell application "Finder"
    if (count of windows) > 0 then
      set winTarget to target of front window as alias
    else
      set winTarget to path to desktop
    end if
  end tell
  
  set winTarget to quoted form of (POSIX path of winTarget)
  
  tell application "Terminal"
    if (busy of front window) = true then
      do script "cd " & winTarget
    else if (busy of front window) = false then
      tell front window
        do script "cd " & winTarget in selected tab
      end tell
    end if
  end tell
  
on error eMsg number eNum
  tell me to display dialog eMsg & return & return & eNum
end try


[ Reply to This | # ]