Problem is that all PuTTY windows are named 127.0.0.1. MsgBox, %TITLE%, CreateFile failed - error %A_LastError%. MsgBox, %TITLE%, AttachConsole failed - error %A_LastError%. If (!DllCall("AttachConsole", "uint", pid)) VarSetCapacity(text, ConWinWidth*ConWinHeight) MsgBox, %TITLE%, ReadConsoleOutput failed - error %A_LastError%. VarSetCapacity(buf, ConWinWidth*ConWinHeight*4, 0) MsgBox, %TITLE%, GetConsoleScreenBufferInfo failed - error %A_LastError%. If (!DllCall("GetConsoleScreenBufferInfo","uint",hConOut,"uint",&info)) GetConsoleText(ConWinWidth, ConWinHeight) MsgBox, %TITLE%, Console port to device "%NAME%" is not responding!`nSometimes it can be unlocked by opening a bunch of consoles (~3 for Dynamips) If (RegExMatch(GetConsoleText(ConWinWidth, ConWinHeight), REGEX) > 1)
WinSetTitle, ahk_pid %NewPID%, %NAME% - AUX Port. WinMove, ahk_pid %NewPID%, X_Pos+(mod(PORT, 10)*50)-250, Y_Pos+(mod(PORT, 10)*45)-200, X_WIN, Y_WINĮxitApp Manage output to Dynamips only - Until I find a way to do it for Qemu/Pemu WinGetPos, X_Pos, Y_Pos, ahk_pid %NewPID% REGEX = (%NAME%|ciscoasa|pixfirewall)|Password:|Username:|login:|Telnet connection.*Press any key to exitĬonWinWidth = 32 Maximum router hostname length + # + 1 (CMD line length)ĬonWinHeight = 100 How many lines to read from CMD output Run, %TOOL% -telnet %HOST% %PORT%, NewPIDĮlse Default mode if another tool is used Run, %comspec% /C %TOOL% %HOST% %PORT%&ECHO.&TITLE %NAME% - Console is closed!&ECHO Telnet connection "%HOST%:%PORT%" to "%NAME%" console port is lost!&ECHO Press any key to exit.&PAUSE >NUL, NewPID If (InStr(TOOL, "telnet.exe") || InStr(TOOL, "nc.exe")) MsgBox, %TITLE%, Invalid parameters number - Must be 6! PuTTY is changing its name back after minimizing the window!Ĭonsole_wrapper.exe "program.exe" `%h `%p `%d Ĭonsole_wrapper.exe telnet.exe `%h `%p `%d 920 420Ĭonsole_wrapper.exe nc.exe `%h `%p `%d 920 420Ĭonsole_wrapper.exe putty.exe `%h `%p `%d 920 420Ĭonsole_wrapper.exe putty.exe 127.0.0.1 2002 R1 920 420
Works great with Telnet, sometimes with Netcat and partial with PuTTY. This is useful for me because otherwise that router eats one CPU core. Until the device console from Routers (Dynamips) will show the prompt. Those values are in pixels, recommended 920 420.ģ) After the telnet connectivity is done, it will push some "Enter" keys Script used to open a telnet program to a GNS3 device Console/AUXġ) It will change the Window Title according to the device hostname.Ģ) Also will resize that window as specified in TITLE = Telnet Wrapper Script For GNS3 - by N!NiX - 27/Apr/2012
WinSetTitle, ahk_pid %NewPID%, %NAME% - Console Port. Run, putty.exe -telnet %HOST% %PORT%, NewPID If (!DllCall("AttachConsole", "uint", NewPID)) And also this in not working to extract window content TEXT This is what I tried, but definitely not working ))ĬontrolSend, %NewTitle%, ahk_pid %NewPID% This is what PuTTY receive from a Telnet/SSH session as a remote window title changing command So this script will send a enter (ControlSend ) every second, check again the PuTTY output and send again until the Router/ASA/Pix prompt is shown (In idle state eats one CPU core - Dynamips only)
#Permanent Title Bar Changer how to
There is a way to change PuTTY Title in Linux with a command like this, but I have no idea how to push this as coming from the telnet session and not as a user input (with ControlSend)Īlso I want to extract PuTTY text from that window and to match it against a reg-ex REGEX = (%NAME%|ciscoasa|pixfirewall)|Password:|Username:|login: I don't want to use the script to change that Title every 1 second and to be forced to have in background running one AutoHotKey script (compiled version) for each PuTTY window (memory inefficiency/CPU usage) I use this script which works great, but PuTTY is changing back its Window Title after the window is resized or minimized :x So, I need to dynamically rename each of them with devices hostname. Problem is that all PuTTY windows are named 127.0.0.1 I use GNS3 for training and PuTTY as telnet client to devices console port on localhost.