December 14, 2009

PathTools and iTerm instead of Terminal

So as noted, I tried using PathTools with FleBuilder under Eclipse 3.5 except FlexBuilder just has too many issues under 3.5. I gave up on PathTools with FlexBuilder but it’s been just awesome with the recent JaveEE 3.5 build. I only had one not-even-gripe as there really isn’t anything to complain about. It opens Terminal for the new paths instead of iTerm. Fortunately a little scripting later and it’s all good based on some code from the iTerm site and also this snippet.

You can see in the PathTool preferences what is called in order to do some of the interaction. Launching a terminal in the selected path is simple enough and is located here: /Applications/eclipse/configuration/org.eclipse.osgi/bundles/685/1/.cp/scripts/cdterminal.scpt

Changing that to the following makes it launch iTerm instead, with a little simple error correction. I hadn’t done Applescript stuff before so was just trying it out. I love these little bits of integration/customizations that are possible.

on run argvset cdTo to item 1 of argvtell application “iTerm”activate— talk to the first terminaltell the first terminal— launch a default shell in a new tab in the same terminaltrylaunch session “Default Session”on errordisplay dialog “There was an error creating a new tab in iTerm.” buttons {“OK”}end trytell the last sessiontry— cd to the requested cdTo pathwrite text “cd ” & cdToon errordisplay dialog “There was an error cding to the requested path.” buttons {“OK”}end tryend tellend tellend tellreturnend run