Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

how to read text on screen transmitted from remote site 1

Status
Not open for further replies.

lsdubois

Programmer
Nov 7, 2005
2
US
Hi,
I need to be able to be able to read the contents of an email inbox.

The screen will look something like the following:
1) Message Apple
2) Message Banana
3) Message Carrot
Select one of the above or press N)Next or P)Previous

My job is to find the first message that says "Banana" for example. I then need to parse the line to figure out the number of the message (e.g. "2").
I have tried using rget and comread and I keep running into problems. Also I am having trouble getting an entire line to be read into the buffer at one time.
Any suggestions? (Most of my script contains Transmits and Wait Fors.)
Thanks,
Lindy
 
Usually I find it easiest to write the screen to a text file (if it's just one screen, use the snapshot command), then open that text file using fopen and look for the string using strfind. Once you have found the correct line, you can use You can then use strfind a second time to search for the ) character and use the optional integer argument to get the location of that character in the string. Decrement that value by one and use it as the argument in the substr command to read that one character.

 
Thanks so much for your suggestion. I used Snapshot to save the screen contents to a text file and then used strfind and substr to find my selection. Your description was very thorough and helpful. Thanks again, Lindy
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top