Value Property Example

This example uses the Value property to log on to a simulated host (using the SlideShow connection type). Note that the While...Wend statement is used to test if the logon screen has appeared. Alternatively, you can use the WaitForString method to test this condition.

Sub Main()

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

 

 Set Sys = CreateObject("EXTRA.System")

 Set Sess = Sys.ActiveSession

' Assumes an open session

 Set MyScreen = Sess.Screen

 Set MyArea = MyScreen.Area(23, 6, 23, 6, , 3)

 

 ' This macro is designed for the "slide show" session

 MyArea.Value = "a"

 MyScreen.SendKeys ("<Enter>")

 

 Set MyArea = MyScreen.Area(20, 2, 20, 7, , 3)

 nCounter = 0

 maxCounter = 500

 Wait$ = "USERID"

 While ((Watch$ <> Wait$) And (nCounter < maxCounter))

  Watch$ = MyArea.Value

  nCounter = nCounter + 1

 Wend

 

 If nCounter = maxCounter Then

  MsgBox Wait$ + " not found in time."

 Else

  Set MyArea = MyScreen.Area(20, 16, 20, 23, , 3)

  MyArea = "user1"

  ' This is identical to MyArea.Value = "user1"

  MyScreen.SendKeys ("<Enter>")

 End If

End Sub