Eu tenho um script AutoHotkey simples para lidar com qualquer sessão Telnet / SSH aberta no Windows.
Pode ajudar alguém:
SetTitleMatchMode 2 ; 2 - partially, 3 - exact match
MyWinTitle=- PuTTY ; Describe the window for keep alive signals
Timeout=180000 ; Call KeepAlive every 180 seconds (180000 ms)
ttl := Timeout / 1000
ToolTip, Keepalives every '%ttl%' seconds for the last touched '%MyWinTitle%' window'nTo stop the keepalive press F12
SetTimer, RemoveToolTip, 3000 ; Shows the tooltip for 5 seconds
return
RemoveToolTip:
SetTimer, RemoveToolTip, Off ; only once
ToolTip
Gosub, MyKeepAlive
Return
MyKeepAlive:
WinGetActiveTitle, Title
IfWinExist, %MyWinTitle%
{
WinActivate
WinGet, mywin_id
WinGetActiveTitle, mywin_title
Send {!}{BS}
MsgBox,,Info message, The window for keep-alives is '%mywin_title%',3
WinActivate, %Title%
}
else
{
MsgBox,,Exit message, Open the window first!,10
ExitApp
}
SetTimer, KeepAlive, %Timeout%
Return
KeepAlive:
WinGetActiveTitle, Title
WinGetTitle, current_title, ahk_id %mywin_id%
If current_title = %mywin_title%
{
WinActivate, ahk_id %mywin_id%
Send {!}{BS}
WinActivate, %Title%
}
else
{
MsgBox,,Exit message, The window was closed!,10
ExitApp
}
Return
Return
F12::ExitApp ; Exit button