'This sample selects all the text on the screen when the Command prompt appears.To run this sample, create a VT session with the Host IP address set as demo:Unix
'and paste the code into the ThisScreen code window. Then log in with any credentials and enter "demodata" at the "demo:" prompt.
Private Sub Screen_ControlKeySent(ByVal sender As Variant, ByVal Key As Attachmate_Reflection_Objects_Emulation_OpenSystems.ControlKeyCode)
Dim returnValue As ReturnCode
Dim LF As String
LF = Chr(10)
'wait for the string obtained from a recorded macro and allow typing while waiting
returnValue = ThisScreen.WaitForString3(LF & "Command> ", 1000, WaitForOption.WaitForOption_AllowKeystrokes)
If (returnValue = ReturnCode_Success) Then
Debug.Print "At the Command prompt"
ThisScreen.SelectAll
End If
End Sub
'This sample navigates to a screen and waits until a string is received from the host. The wait never times out and allows typing while waiting.
'To run this sample, create a VT session with the connection type set to TelNet and the Host name/IP address field set to "unix:demo"
'and log in to the demo with any text.
Sub NavigateWithWaitForString3()
Dim rcode As ReturnCode
Const NEVER_TIME_OUT = 0
'Enter a command
ThisScreen.SendKeys "demodata"
ThisScreen.SendControlKey ControlKeyCode_Return
'Wait for a string on the host screen before continuing. Specify to never timout and allow typing while waiting
rcode = ThisScreen.WaitForString3(LF & "Command> ", NEVER_TIME_OUT, WaitForOption_AllowKeystrokes)
If rcode = ReturnCode_Success Then
'Continue with commands
End If
End Sub