Many (but not all) devices can create events. An event occurs if V-Control receives a string from a channel without sending a command before. This example explains how to use events to control V-Control from another application. To follow this example a RS232 channel and the Generic Device from the I/O category is needed ( see Configure Channels and Configure Devices). If configured, call the Device Editor via main menu Configure → Edit Devices… and select the OnData event.
As you can see, the value of TabID is Events. This causes the command to be listed in the event list. The Parameter 1 (“In Data = ”) determines the received string that causes the event. Ack in Hex is set to 0D (13) and determines the termination character of the received string.
01 IOResult = Left(IOResult,Len(IOResult)-1) 02 If IOResult = P1 Then 03 ACK = True 04 ScriptResult = IOResult 05 Else 06 ACK = False 07 ScriptResult = IOResult 08 End
Line 1 deletes the termination character, and line 2 checks if the received string is the same than the expected (P1). If this is the case, then ACK becomes true and the system knows that we have a valid event. If this event is linked to a task, then the task is executed (see Device Events).