×
INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

Can I use "WaitForString" with multiple responses?

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

   dim strings(1), i

   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,

glassesJust traded in my old subtlety...
for a NUANCE!tongue

RE: Can I use "WaitForString" with multiple responses?

(OP)
Thanks for the quick response.  That didn't work for me.

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,

glassesJust traded in my old subtlety...
for a NUANCE!tongue

RE: Can I use "WaitForString" with multiple responses?

(OP)

Atachmate Reflection's Visual Basic

a terminal emulator


 

RE: Can I use "WaitForString" with multiple responses?

(OP)
Sorry,

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,

glassesJust traded in my old subtlety...
for a NUANCE!tongue

RE: Can I use "WaitForString" with multiple responses?

(OP)
Sorry, didn't follow what you were asking.  I get to the looping portion because the status bar displays "in loop", but this macro never ends.


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?


Quote (ExtraHELP):

Description

Waits until the specified text appears on the screen. The Screen object will wait for the amount of time set in System.TimeoutValue.

Syntax

rc = object.WaitForString (Text [,Row [,Col [,Page]]])

-or-

object.WaitForString String [,Row [,Col [,Page]]]

Element    Description
rc    The return value.
object    The Screen object.
String    The text string that you want the Screen object to wait for.
Row    The row where you expect the string to appear.
Col    The column where you expect the string to appear.
Page    VT session only -- the screen page.Note: This parameter is ignored for release 6.0 of EXTRA!o.

Copyright 1996 - 1999, Attachmate Corporation. All rights reserved.

Skip,

glassesJust traded in my old subtlety...
for a NUANCE!tongue

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members! Already a Member? Login

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close