Elasticfox, OSX and iTerm

01 October 2008

applescript ec2 elasticfox osa osx

Elasticfox is a nice extension for managing your relationship with EC2 from within Firefox. It's XUL-based, somewhat homely and odd. But it's so much nicer than dealing with the ec2-* scripts directly and copying Amazon's wacky hash identifiers hither and thither.

But on OSX, the "ssh to this instance" button is wired up to Terminal.app. I can't stand Terminal.app. I much prefer iTerm.

So, a little AppleScript hacking, and Elasticfox now uses iTerm to connect to instances through ssh.

Instead of jamming it all into a dozen -e options on osascript, I just put it in a file, and changed my configuration.

Elasticfox configuration

And the script itself:

on run argv
  tell application "iTerm"
    set cmd to "ssh -i " & item 1 of argv & " " & item 2 of argv
    set myterm to the last terminal
    tell myterm
      launch session "Default Session"
      tell the last session
        write text the cmd
      end tell
    end tell
  end tell
end run