RuTTY 0.14.08

RuTTY - a modified version of PuTTY
PuTTY is copyright 1997-2013 Simon Tatham
RuTTY is copyright 2013, Ernst Dijk

Record and Replay PuTTY, RRPuTTY, RuTTY !
RuTTY adds scripting to PuTTY, scripting the easy way, record and replay.

Introduction
Ever needed to send a list of commands to a host ?  Copy and Paste is a possibility. 
However, sometimes the list is to long for the host to handle, so you end up copying/pasting every single line.
RuTTY waits after sending a command, a fixed amount of time, or even for the host prompt to return.
RuTTY can also check host response for 'forbidden' words like "error" and "failed".

example:
many command lines, fastest command needs 10ms to execute, the slowest 2 seconds. prompt is " m2@m $ "
- set line delay to 2000ms 
- or enable 'wait for host response', enter the prompt as 'wait for' condition
- if one of the commands would change the prompt you could leave 'wait for' empty and set a small line delay like 10ms
- or you can enter both prompts as a 'wait for' condition, using qouted words: "m2@m$" "m2@m /home $"
- or, to make sure cd /home was successfull, enter it as a condition in your script file:
    ...
    cd /home
    ::this is a comment line, the condition below makes the script wait for the changed prompt
    :m2@m /home $
    ...

example 2:
conditions in file can be used for automated login:
  ::wait for the login question
  :login
  your_username
  :password
  your_password

Editing script files
RuTTY records what you type, not what is send to the host. RuTTY records lines, when you press Enter a Cariage Return is recorded, a LineFeed is added to mark the end of the line, and the line is stored in the file. 
At replay the line is read, the LF removed, and the line is send to the terminal.

Note: when you press Enter the terminal emulator might send CR or CR+LF to the host.
Same with replay, when sending an CR to the terminal emulator it might send CR or CR+LF to the host.

If you create a script file with a linux style of editor only a LF is added when you press Enter, you must put the CR in the file yourself or change the 'CR/LF translation' settings.  A dos/windows editor puts CR+LF in the file when you press Enter.  Lines without a CR can be usefull though, p.a. a menu choise where you only would need to press 1 and not 1 + Enter. 

When editing a recorded script please note that a CR is recorded as CRLF, a LF as LFLF, a CRLF as CRLFLFLF

Explanation of the Session/Scripting panel

Script filename   
Off | Replay | Record
Enter a filename and select the action what to do when starting this session
Replay: the file must exist
Record: the file must not exist
In case of an error, the error message is written in the Event Log 
Note: 'Record' mode is not saved. It's once, this session only.
'Replay' mode is stored with saved session, so it can be used for automated to login

line delay (ms) 
delay before sending a command line to the host 
there is a mimimun delay of 5 ms

character delay (ms)
delay before sending each character of the command line
special cases:
0 =  Off, send the line as one message
1 =  send each character as a single message
> 1  delay in milliseconds
note: depending on OS there is a mimimum delay
for windows it is documented as10 ms.

start of condition/comment line
a single character witch is used to mark the start of a condition/comment line
if it's for example ':', then the lines in the file can be:
::comment line
:condition, if enabled, this line must match before the command line is send
command line, this line will be send to the host
see 'use conditions from file' below 

LF translation
Off | no LF | CR | LF | CRLF
Lines in a file are seperated with LF, or even CR/ LF in windows
In a terminal session if you press 'Enter' a CR is recorded, however in most cases CR/LF is send to the host.

no LF	remove the LF from the command line to send
	wile recording a LF was added to seperate the lines in the file
	note: all LF's are removed !

CR	replace CR/LF with CR
	if you created a script file with a linux style of editor, there is only a LF at line end
	to send the line to the host normaly a CR is needed

Rec	recorded script file. a LF is recorded as LFLF, CR as CRLF, CRLF as CRLFLFLF
	also CRLFLF is translated to CRLF
  
Off	lines in the script file are send including the terminating LF

halt on 
Script replay is stopped if this line or one of the qouted words is found in the host response 
for example:
system has failed - if this hole line matches a host response the script is halted
"error" "ERROR"   - if one of these words matches script is halted
Note: only if the first character is " qouted words are compared instead of the complete line

wait for response from host
e.g. wait for a prompt

except for first line 
on some systems you must send first a few CR's before a prompt is given

timeout (s)
time to wait for a response from the host in seconds

wait for 
The response from host to wait for, e.g. a prompt
'OK' for example when using a modem, or 'C:\>' in DOS
If left empty, any host resonse will do
When the line starts with ", the qouted words are compared instead of the complete line 
e.g. "C:\>" "C:\myfolder>"

use conditions from file
If the 'start of condition/comment line' character would be ':'
then when recording the response from host is marked with a ':' at line start
At replay RuTTY will wait for the same response before sending the next command line
an example: 
:c:\>
cd \myfolder
:c:\myfolder>
del *.obj
RuTTY will stop the script if the host response after 'cd \myfolder' is not 'c:\myfolder>'
p.a. if the response would be 'C:\MyFolder>' the script will be halted.
Conditions can also be qouted words or part of a line, e.g. :"c:\myfolder>" "C:\MyFolder>"
If there are no conditions in the script between command lines, then default 'wait for' will be used

known limitations
- 'halt on' and 'wait for' are limited in size, max 256 characters
- replay, using host response as a condition, only the last 256 characters are used,
  except if the expected host response is qouted, then the fist 256 characters are used.

known bugs
- when closing a session before pressing enter, the last line is not recorded (in most cases not send to the host either)
- keyboard is not locked during replay, especialy paste (done with the right mouse button) is dangerous

2013-08-08