Can I use "WaitForString" with multiple responses?
Can I use "WaitForString" with multiple responses?
(OP)
How can I use "WaitForString" with multiple responses?
This might not even be the correct command to use.
I want to send a command then wait for a response before I proceed. I have no problem writing this code waiting for a single known response, but I may need to wait or have a conditional branch depending on multiple responses. I will have a set of known responses I can test against, but only one response will occur.
For example the response may be "completed" or "not found". One response I would want to continue the macro, the other end or branch to a new macro.
.Transmit my_Command
.WaitForString "completed" ' continue with macro_1
or
.WaitForString "not found" ' end macro or go to macro_2
*************
almost something like ->
.WaitForString {
"completed" then continue
"not found" then macro_2
"error" then End Sub
}
**************
If there is a better command, I am open for suggestions.
Thanks,
JunoFlyDog
RE: Can I use "WaitForString" with multiple responses?
hi,
CODE
strings(0) = "completed"
strings(1) = "not found"
do while scrn.waitforstring(strings(i),r,c)
i=i+1
if i > 1 then i = 0
loop
Skip,
Just traded in my old subtlety...
for a NUANCE!
RE: Can I use "WaitForString" with multiple responses?
By putting .StatusBar comments, I can tell it gets to the loop with proper command syntax (no errors), but never triggers on the test string.
I would think this would never work unless this has worked for you in the past. My thinking is that since the terminal window is a stream, the correct test variable would have to be selected when the text scrolled through, otherwise the loop would miss the data stream.
Any other thoughts?
JunoFlyDog
RE: Can I use "WaitForString" with multiple responses?
exactly WHAT code are you using?
Skip,
Just traded in my old subtlety...
for a NUANCE!
RE: Can I use "WaitForString" with multiple responses?
Atachmate Reflection's Visual Basic
a terminal emulator
RE: Can I use "WaitForString" with multiple responses?
Not thinking clearly since this is an Atachmate forum.
I am simply writing a macro that will send a command, then branch (or pause) waiting for a reply.
Other than that, I don't know what you mean by "WHAT code are you using".
RE: Can I use "WaitForString" with multiple responses?
I cannot help you if you will not post your code!!!
I do not have a crystal ball!!!
Skip,
Just traded in my old subtlety...
for a NUANCE!
RE: Can I use "WaitForString" with multiple responses?
CODE
Sub my_park()
With Session
My_Macros.my_screen_worklist ' this macro calls a worklist page
Dim my_Search(1), i
my_Search(0) = "end of worklist"
my_Search(1) = "no tickets"
i = 0
.StatusBar = "before loop"
Do While .WaitForString(my_Search(i))
i = i + 1
If i > 1 Then i = 0
.StatusBar = "in loop"
Loop
.StatusBar = "after loop"
End With
End Sub
RE: Can I use "WaitForString" with multiple responses?
Skip,
Just traded in my old subtlety...
for a NUANCE!