Programming with Reflection
WaitForEvent method
Syntax object.WaitForEvent EventType, Timeout, Duration, Row, Column
Begins a wait that is satisfied by the occurrence of the specified event. The procedure containing the command is paused until the event occurs or the timeout period expires. If the timeout period expires, an error occurs.
EventType Argument type: Enumeration
The event for which to wait. The values are:
rcSilence
Waits for the absence of data traveling to or from the host. Use the Timeout argument to specify how long to wait for a period of silence, and Duration to specify how long that period must last. Use 1 as the value for Row and Column; these arguments are not relevant for this type of event. For example, the following statement waits for a 10 second period of silence (with a 30 second timeout).
.WaitForEvent rcSilence, "30", "10", 1, 1
rcKbdEnabled
Waits for the keyboard to be unlocked for the specified duration. Use the Timeout argument to specify how long to wait for the keyboard to be enabled, and Duration to specify how long the keyboard must remain enabled. Use 1 as the value for Row and Column; these arguments are not relevant for this type of event. For example, the following statement waits for a 10 second period with the keyboard enabled (with a 30 second timeout).
.WaitForEvent rcKbdEnabled, "30", "10", 1, 1
rcEvConnected
Waits for a host connection. Use the Timeout argument to specify how long to wait for the connection to occur. Use an empty string ("") as the value for Duration, and 1 as the value for Row and Column. For example, this statement waits for a connection with a one minute timeout.
.WaitForEvent rcEvConnected, "0:01:00", "", 1, 1
rcEvDisconnected
Waits for the lack of a host connection. Use the Timeout argument to specify how long to wait for the connection to be terminated. Use an empty string ("") as the value for Duration, and 1 as the value for Row and Column. For example, this statement is satisfied when no connection is present. The timeout is 45 seconds.
.WaitForEvent rcEvDisconnected, "45", "", 1, 1
rcEnterField
Waits for the cursor to be located in the field that contains the specified Row and Column arguments. Use the Timeout argument to specify how long to wait for the cursor to enter the field at the specified coordinates. Use an empty string ("") as the value for Duration. For example, the following statement is satisfied when the cursor is positioned in the field that includes row 20, column 17:
.WaitForEvent rcEnterField, "10", "", 20, 17
rcExitField
Waits for the cursor to be in a location other than the field that contains the specified Row and Column arguments. Use the Timeout argument to specify how long to wait for the cursor to exit the field at the specified coordinates. Use an empty string ("") as the value for Duration. For example, the following statement is satisfied when the cursor is not positioned in the field that includes row 20, column 17:
.WaitForEvent rcExitField, "10", "", 20, 17
rcEnterPos
Waits for the cursor to reach specified screen coordinates (as identified by the Row and Column arguments). Use the Timeout argument to specify how long to wait for the cursor to reach the specified coordinates. Use an empty string ("") as the value for Duration. To specify any row or column, use the value rcAnyRow or rcAnyCol, but not both at the same time. The following statement is satisfied when the cursor is located at row 20, column 17:
.WaitForEvent rcEnterPos, "10", "", 20, 17
rcExitPos
Waits for the cursor to be at any screen coordinates other than specified coordinates (as identified by the Row and Column arguments). Use the Timeout argument to specify how long to wait for the cursor to leave the specified coordinates. Use an empty string ("") as the value for Duration. To specify any row or column, use the value rcAnyRow or rcAnyCol, but not both at the same time. The following statement is satisfied when the cursor is not located at row 20, column 17:
.WaitForEvent rcExitPos, "10", "", 20, 17
rcNewHostScreen
Defines an event as a new screen from the host. Use an empty string ("") for the Duration and String arguments, and 1 for Row, Column, and Key; these arguments are not relevant for this type of event. For example, the following statement is satisfied when a new host screen appears, with an error occuring if the wait is more than 5 minutes.
WaitForEvent rcNewHostScreen, "0:05:00", "", 1, 1
rcPrinterOpened
Waits for printer to open and start a print job. Use the Timeout argument to specify how long to wait. Use an empty string ("") for Duration, and 1 for Row and Column. For example, this statement waits for a start of job with a one-minute timeout:
.WaitForEvent rcPrinterOpened, "0:01:00", "", 1, 1
rcPrinterStartOfPage
Waits for the start of a page. Use the Timeout argument to specify how long to wait. Use an empty string ("") for Duration, and 1 for Row and Column. For example, this statement waits for a start of page with a one-minute timeout:
.WaitForEvent rcPrinterStartOfPage, "0:01:00", "", 1, 1
rcPrinterEndOfPage
Waits for the end of a page. Use the Timeout argument to specify how long to wait. Use an empty string ("") for Duration, and 1 for Row and Column. For example, this statement waits for an end of page with a one minute timeout:
.WaitForEvent rcPrinterEndOfPage, "0:01:00", "", 1, 1
rcBeforePrinterClosed
Waits for the end of a print job (before actually closing the printer or file). Use the Timeout argument to specify how long to wait for the connection to occur. Use an empty string ("") for Duration, and 1 for Row and Column. For example, this statement waits for an end of job with a one minute timeout.
.WaitForEvent rcBeforePrinterClosed, "0:01:00", "", 1, 1
rcPrinterClosed
Waits for the print job to be finished (after closing the printer or file). Use the Timeout argument to specify how long to wait. Use an empty string ("") for Duration, and 1 for Row and Column. For example, this statement waits for a print job to be finished with a one-minute timeout:
.WaitForEvent rcPrinterClosed, "0:01:00", "", 1, 1
Timeout Argument type: String
Specifies an interval of time in HH:MM:SS format. The wait terminates if this amount of time passes without the specified event occurring. If this method times out, an error occurs.
Duration Argument type: String
Specifies an interval of time in HH:MM:SS format. The specified event must last this long to satisfy the wait. This argument is only relevant if the event is set to rcSilence or rcKbdEnabled. Use an empty string for this argument ("") for other event types.
Row Argument type: Integer
This value is only relevant if EventType is set to rcEnterField, rcExitField, rcEnterPos, or rcExitPos. For the wait to be satisfied, the cursor must enter (or exit) the field at the specified row and column coordinates. If event is not set to rcEnterField, rcExitField, rcEnterPos, or rcExitPos, use 1 as the value of this argument. You can also use rcMouseRow to specify the row where the mouse was last clicked.
Column Argument type: Integer
This value is only relevant if EventType is set to rcEnterField, rcExitField, rcEnterPos, or rcExitPos. For the wait to be satisfied, the cursor must enter (or exit) the field at the specified row and column coordinates. If EventType is not set to rcEnterField, rcExitField, rcEnterPos, or rcExitPos, use 1 as the value of this argument. You can use rcMouseCol to specify the column where the mouse was last clicked.