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!

waitfor using 2 expressions? 2

Status
Not open for further replies.

castout

Programmer
Jan 22, 2002
23
US
Does anyone know how I can use "waitfor" with two expressions? For example, I need to say:
Code:
waitfor "abc^M" or "123^M"
Then, I need to react differently depending on which string I receive.
 
Check out this thread.

thread448-123417

If you have anymore questions I'm sure someone in this forum can help out.

Matt
 
"When Target" is the standard way to look for more than one prompt simultaneously. The only complicated aspect (no pun intended) of "When target" is that you have to call a subroutine. You can use a waitfor in the normal procedure and "When target" to interrupt the process with a different response.

Here is a fictitious example where a script will send as return key if the normal waitfor is detected or a "logoff" and exit command if the when target is detected:

Proc Main
when target 1 "last Page" call SessionEnd
transmit "Reports Please^M"
Waitfor "to next page" forever
transmit "^M"
when target 1 clear
EndProc

Proc SessionEnd
transmit "logoff^M"
exit
EndProc

The when command will remain active until you include the "When Target clear" statement shown in the example. Robert Harris
Communications Advantage
 
castout
Robert's approach is the superior solution. I would suggest implementing it.

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top