A handy AutoHotkey snippet to restart a PuTTY session after it gets disconnected, press Ctrl + R in the session to restart.

More ids for putty shortcuts can be found here.

if WinActive("ahk_class PuTTY") {
^r:: ; ^r = Ctrl + R
TrayTip, PuTTY, Restarting Session...
WinGet, process, processName, % "ahk_id" hwnd := hwnd? hwnd:WinExist("A")
WinGetClass class, ahk_id %hwnd%
;0x112 = SYS_COMMAND, 0x40 = IDM_RESTART
PostMessage, 0x112, 0x40,,, ahk_id %hwnd%
Return
}

Advertisement