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

Click here to return to the '10.4: Use Automator to open chosen folder in Terminal' hint
The following comments are owned by whoever posted them. This site is not responsible for what they say.
10.4: Use Automator to open chosen folder in Terminal
Authored by: sporkstorms on Sep 03, '05 08:03:05PM

Here are a few more changes:

  • Works with iTerm
  • Opens a new terminal or tab for each file selected
  • if the selected thing isn't a folder, it cd's to that files folder instead of erroneously trying to cd to the file itself.

You can also download this dmg

on run {input, parameters}
   tell application "iTerm"
      repeat with someFilename in input
         make new terminal
         tell the first terminal
            activate current session
            launch session "Default Session"
            tell the last session
               set thePath to (quoted form of POSIX path of 
                  (someFilename as string))
               set cdCommand to "if [ -d " & thePath & " ]; then cd "  
                  & thePath & "; else cd `dirname " & thePath &  
                  "`; fi; clear"
               write text cdCommand
            end tell
         end tell
      end repeat
   end tell
   return input
end run

[ Reply to This | # ]