Ramblings

December 14, 2009

PathTools and iTerm instead of Terminal

Filed under: applescript, automation, eclipse, iterm, osx, pathtools, Uncategorized — michaelangela @ 9:44 am

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 argv
set cdTo to item 1 of argv
tell application “iTerm”
activate
— talk to the first terminal
tell the first terminal
— launch a default shell in a new tab in the same terminal
try
launch session “Default Session”
on error
display dialog “There was an error creating a new tab in iTerm.” buttons {“OK”}
end try
tell the last session
try
— cd to the requested cdTo path
write text “cd ” & cdTo
on error
display dialog “There was an error cding to the requested path.” buttons {“OK”}
end try
end tell
end tell
end tell
return
end run

Advertisements

Leave a Comment »

No comments yet.

RSS feed for comments on this post. TrackBack URI

Leave a Reply

Please log in using one of these methods to post your comment:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

Blog at WordPress.com.

%d bloggers like this: