IV Needle Injecting Tech into the Vein

13Nov/09Off

Connecting to an SSH server, really really fast

This post assumes you have the following: an ssh server, putty, and autohotkey-a desktop scripting tool.

  1. Open Putty, and create a session with any and all settings you would want in putty. Add tunnels, compression, etc, whatever you usually do when you start a putty session
  2. Save your session for future use. You'll use the name of this session later.
  3. Write a simple batch script that will load putty, and send a user name and pw.  Mine looks like this: "\putty.exe -load sessionname -l username -pw password
  4. Save your batch file.
  5. This s where we start using autohotkey.  You'll want to download this, and open it to create a new autohotkey script. Here's how my script looks:
;
; AutoHotkey Version: 1.x
; Language:       English
; Platform:       Win9x/NT
; Author:         A.N.Other <myemail@nowhere.com>
;
; Script Function:
;    Template script (you can customize this template by editing 

"ShellNew\Template.ahk" in your Windows folder)
;

#NoEnv  ; Recommended for performance and compatibility with future AutoHotkey 

releases.
SendMode Input  ; Recommended for new scripts due to its superior speed and 

reliability.
SetWorkingDir %A_ScriptDir%  ; Ensures a consistent starting directory.
#p::
Run "location of your putty batch file"
WinWaitActive, ahk_class PuTTY,,3
WinMinimize
WinWaitActive, ahk_class ConsoleWindowClass,,3
WinMinimize
return

#c::
If WinExist("ahk_class PuTTY")
{
 WinClose
}
If WinExist("ahk_class #32770")
{
 WinActivate
 Send {Enter}
}

return

Save that script and run it. When ever you press windowkey+p it will start putty.  When ever you press windowkey+c it will close putty!