Icon_search
Profile

Mac OSX Open Terminals from Location in Finder

Posted on 09/10/2007 by Adam
 | 

When working on projects I normally have multiple terminals open in the project directory. I found it quite annoying to type cd /path/to/project in every terminal so I wrote this script that can be used in Automator to open my terminals and change to the directory for me.

on run {input, parameters}
 set topleft to {5, 25}
 set topright to {860, 25}
 set bottomleft to {5, 520}
 set bottomright to {860, 520}
 set locations to {topleft, topright, bottomleft, bottomright}
 repeat with loc in locations
  tell application "Terminal"
   activate
   with timeout of 1800 seconds
    set firstpath to item 1 of input
    do script with command "cd " & (quoted form of POSIX path of firstpath)
    tell window 1
     set position to loc
     set number of columns to 130
     set number of rows to 32
    end tell
   end timeout
  end tell
 end repeat
end run

Tagged:  osx