This example defines event 1 as the cursor in row 20, column 7. The procedure waits for the cursor to enter that position. If the cursor enters that position before the 10-second timeout, information is transmitted to the host, if not the error handler, which in this example displays a message indicating that the time expired.

Sub WaitForCursorPosition ()

 With Session

  'Define Event 1 as cursor in position 20,7

  .DefineEvent 1, rcEnterPos,"","", 20, 7, 1


  'Wait for the cursor to enter that position

  'Display a message when the event is satisfied

  'or use error handling to catch a time out.

  On Error Goto Handler

  .WaitEventNumber 1, "10"

  .TransmitANSI "1"

  .TransmitTerminalKey rcIBMEnterKey

 End With


Exit Sub


 MsgBox "The time expired"

End Sub