IVHooks interface : TaskStarting method

TaskStarting method
Event
A task started.
Description
VWorks software calls the TaskStarting method after a task starts.
Syntax
 
HRESULT TaskStarting(
[in] BSTR sXML,
[in, out] BSTR* sResultXML
);
Parameters
 
[in] A TaskStarting XML block containing information about the task that started and about the protocol that generated the event.
TaskStarting method input
VWorks software passes a TaskStarting XML block into the sXML parameter of the TaskStarting method.
TaskStarting XML block
The TaskStarting XML block contains the TaskStarting element and all its children. This XML block provides information about the task that started, including the names of all devices and locations used by the task.
TaskStarting element
The TaskStarting element has two children: Devices and Locations. The TaskStarting element has the following attributes:
 
If the task is in a main process, the value is the index of this process in the protocol (zero-based).
If the protocol has been saved, the value of this attribute is the protocol’s file path. If the protocol has not been saved, the value is the default protocol name.
1 = Startup
2 = Main
3 = Cleanup
0 = The task is not created by a Spawn Process task
1 = The task is created by a Spawn Process task
Devices element
The Devices element contains one or more Value elements.
Value element
Each Value element contains the name of a device used by the task. This element has the following attribute:
 
Locations element
The Locations element contains one or more Value elements.
Value element
Each Value element contains the name of a location used by the task. This element has the following attribute:
 
Example of TaskStarting method input
The following sample code is a TaskStarting XML element that is received by the plugin from VWorks software as a string in the sXML parameter of the TaskStarting method. VWorks software tells the plugin that the task named Place plate at PlatePad  1 Stage started in the Main Protocol.
 
<TaskStarting Description='Place plate at PlatePad - 1 Stage' InstanceNumber='1'
Path='C:\V11\MyProtocol.pro' ProcessIndex='0' ProcessName='process - 1'
ProtocolPath='C:\V11\MyProtocol.pro' ProtocolType='2' Spawned='0' TaskIndex='0' >
<Devices >
<Value Value='PlatePad - 1' />
</Devices>
<Locations >
<Value Value='Stage' />
</Locations>
</TaskStarting>
TaskStarting method output
The plugin returns a HookResults XML block in the sResultXML parameter of the TaskStarting method. For information about the structure and contents of this XML block, see “HookResults XML block” .
Example of TaskStarting method output
The following sample code is a HookResults XML block that is returned to VWorks software by the plugin as a string in the sResultXML parameter of the TaskStarting method. The plugin tells VWorks software to write the following Info-type message to the Main Log:
Place plate at PlatePad  1 Stage task started.
 
<HookResults>
<Results>
<HookResult ResultType='Log Message'
ResultValue='Place plate at PlatePad - 1 Stage task started.' />
</Results>
</HookResults>
Related information