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 IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Telnet / Waitfor

Status
Not open for further replies.

jeditom

IS-IT--Management
Dec 3, 2003
23
US
I need to develop a script that Telnets (IP) and sends keystrokes into an Adtran modem depending on what the display shows..

The Adtran menu displays a number of options. Does the "waitfor" command scan the entire display before allowing the script to proceed, or does it proceed as soon as it finds a match?

THANKS!
 
The waitfor command looks for the first match that is received. If the information is always after a particular string, you could use two waitfor commands, the one looking for the "here it comes" string, and the second waitfor command looking for the actual data you really want.

Another option, if the data you want always appears on the same line, is to use the termgets command to read a particular line into a string, then get the value you need from that string. Similarly, you could use the snapshot command to save the screen to a text file and parse that line by line.


aspect@aspectscripting.com
 
If you're worried about the waitfor firing off before the prompt is displayed after the entire screen is displayed you can follow the found target waitfor with a waitfor 'prompt' where prompt is the prompt character (or string) at the bottom of the screen. Or just use a waitquiet after the target waitfor or even just make the first line under the target waitfor a pause 3 (3 seconds is usually more than enough time to make sure the display is done.

Hope this helps.

DT
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top