Menu

RuTTY AHK

Ernst

RuTTY AHK

RuTTY, record and replay PuTTY. Sometimes thats not enough, you need more scripting possibilities.

RuTTY is created to configure computer devices, record once, replay many times.
However, many suppliers have there own tools, or the device has a configuration website build in.
To automate that, there is a nice script language: AutoHotkey.
AHK can send keystrokes and mouse clicks to a windows program.

To automate/script RuTTY, RuTTY needs to send lines it receives to AHK, and accept commands/lines from AHK.
Within windows there is the WM_COPYDATA message to send data between programs.
RuTTY 0.15 has the capability to send and receive WM_COPYDATA messages.
I prever to use AHK, but you can use any language that can send and receive windows messages.

RuttyAHK demo

To run the demo RuttyAHK.ahk you need AutoHotkey 1.0., or AutoHotkey 1.1. ANSI.
AutoHotkey can be found here: https://www.autohotkey.com/download/

The demo script RuttyAHK.ahk first starts bouncer.exe, an echo server at localhost:7. Then it starts rutty.exe with a connection to the echo server. RuttyAHK.ahk uses WM_COPYDATA messages to send the data to RuTTY, RuTTY sends it to the echo server, wich echos it back to RuTTY, wich in his turn wil send it to the AHK script.

Send data to RuTTY
Send a WM_COPYDATA message using the correct signature/messageID (see ruttyAHK.inc)

Receiving data from RuTTY
Send a WM_COPYDATA message with your script window title, using the correct signature/messageID.
After a complete line is received by RuTTY it is send to your script (exluding cr/lf ).

RuTTY can send your script a message when a prompt or keyword is received (before end of line).
To set a prompt/keyword, send a WM_COPYDATA message using the correct signature/messageID.
If the prompt/keyword is received by RuTTY from the host the received line is send to your script.
See ruttyAHK.inc for signature/messageID's.


Related

Wiki: Home
Wiki: test page