I'm using a Telnet-like program (Terra-Term)to log into a server to check the status of certain processes. It's a secure-shell connection (ssh) which is needed for remote access to the server.
The problem is that I need to capture the text returned in the window after a command has been sent. SilkTest can interact with the program, enter in text and send the command to the server, but I need to capture the messages that are returned.
For example... I run the command /one/two/dhcpd status
the server returns
dhcpd is running...
and I want to capture this to a string so I can run a check for the work "running".
It would be possible to send the output of the command to a file, but that file would still be on the server. Then I'd have to use Terra-Term to read the file, which leaves me back at the start again...
I'd need to get the text returned from running a command in the Terra-Term window into a file on the local machine.... and I have no idea how to do this..
Actually it's kinda messy but possible. I also use TT for SSH. Anyway, maybe you could just make a declarations for the main window, drag the mouse from the starting point, or do a typekeys to the point where you want it to stop highlighting text then do an ALT+C or from the edit menu select copy, then paste it to a file or where ever you want. Hope this helps...
You could grap the contents of the TeraTerm screen into a LIST OF STRING in memory, then parse the list and look for your anticipated result.
You could put some "smarts" into it to look x lines below a token. For example if the next line below "/one/two/dhcpd status" is where the result would be, then look at the next line and MatchStr or something to evaluate the result.
I automated the telnet that comes with Windows 98 by using a combination of clear commands and the apps copy command. I issue a console command by calling a function that types clear<cr> then the command you wish to run. The function returns a list of string that I got by telling telnet to copy its buffer to the clipboard and then scanning the list of strings to remove the command that was typed. I had some trouble with commands that went over a line and making sure the history was large enough but I've managed to iron out most of the wrinkles. You may be able to adopt a similar method for your app.
Thanks for the help... the clipboard method seems to be the best suited to the task (at least for now). I just had to insert a few sleep(n) statements to make sure the script wasnt running faster than Tera Term could keep up.