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

'Waitfor' with different possible retuned prompts 1

Status
Not open for further replies.

TotoRama

Technical User
Jun 23, 2004
2
US
I have a large script with several 'Waitfor' commands the problem is that some of the returned screens may exceed one page and I am prompted with "press any key to continue or press(q) to quit'. Therefore, when I'm testing for a returned string, I never know when this prompt will crop up. How can I test for this everytime by default?
I.e.

waitfor "press(q) to quit"
OR
waitfor "required response abcd.... etc'
 
For those prompts you need to clear automatically, you can use the when target command to call a procedure to send the Enter key, a space, etc. Here is a quick sample I whipped up that looks for a piece of text in my Unix command prompt (to know that a command finished executing, while also keeping an eye out for the --More-- prompt displayed when doing a file listing. The when target command calls a procedure to send a space to receive the next screen of the file listing, then indicates if the string in my command prompt was received.

proc main
when target 0 "More" call clearit

if waitfor "SUN:"
usermsg "found it!"
endif
endproc

proc clearit
transmit " "
endproc

aspect@aspectscripting.com
 
Hey, Knob,

Tried your suggestion and it worked fine...

Thanks very much for you help. I've been trying to get this to work for weeks.

Very much appreciated.
Regards

TJ

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top