WaitForString Method Example

The example uses WaitforString and SendKeys to page through host demonstration screens (using the SlideShow connection type). Note that with the exception of the first instance of SendKeys, this method is only executed if the WaitForString method returns TRUE.

Sub Main()

 Dim Sys As Object, Sess As Object, MyScreen As Object

 

 Set Sys = CreateObject("EXTRA.System")

 Set Sess = Sys.ActiveSession

' Assumes an open session

 Set MyScreen = Sess.Screen

 

 Sys.TimeoutValue = 9000

 

 ' This will page through a couple of "slide show" host screens.

 MyScreen.SendKeys ("a<Enter>")

 ' This uses row and column optional parameters

 Found1st = MyScreen.WaitForString("COMMAND ===>", 23, 2)

 If Found1st Then

  MyScreen.SendKeys ("user1<Enter>")

  ' This uses neither the row nor the column optional parameters

  Found2nd = MyScreen.WaitForString("Ready;")

  If Found2nd Then

  MyScreen.SendKeys ("logoff<Enter>")

  ' This uses only the row optional parameter

  Found3rd = MyScreen.WaitForString("USSMSG10", 2)

  End If

 End If

 If Not (Found1st And Found2nd And Found3rd) Then MsgBox "Error navigating host screens."

End Sub