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 string, Store into variable 1

Status
Not open for further replies.

aaiqbal

Programmer
Sep 15, 2003
26
US
Hi,
This is Abdul again. Thanks for those of you who have already helped me. I have another question. Is it possible to wait for the next string that shows up and store it into a variable for parsing purposes?
For example: Let's say the terminal will respond with the device's name. So it will always say "I am" followed by its' name. Can I wait for "I am" and then store the next word into a variable? That way, if its' name is "Abdul", I can do one thing and if its' name is "Bob", I can do another
 
You can use something like this to key off the beginning string, then grab the rest of the line:

if waitfor "string"
rget sLine
endif

sLine will contain the remainder of the line that contained the initial string you are looking for. Rget will keep the remainder of the line from appearing on the screen.


aspect@aspectscripting.com
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top