IVHooks interface : TaskFinished method

TaskFinished method
Event
A task is finished.
Description
VWorks software calls the TaskFinished method after a task is finished.
Syntax
 
HRESULT TaskFinished(
[in] BSTR sXML,
[in, out] BSTR* sResultXML
);
Parameters
 
[in] A TaskFinishing XML block containing information about the task that is finished and about the protocol that generated the event.
TaskFinished method input
VWorks software passes a TaskFinishing XML block into the sXML parameter of the TaskFinished method.
TaskFinishing XML block
The TaskFinishing XML block contains the TaskFinishing element and all its children. This XML block provides information about the task that is finished, including the names of all devices and locations used by the task.
TaskFinishing element
The TaskFinishing element has two children: Devices and Locations. The TaskFinishing 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 TaskFinished method input
The following sample code is a TaskFinishing XML element that is received by the plugin from VWorks software as a string in the sXML parameter of the TaskFinished method. VWorks software tells the plugin that the task named Place plate at PlatePad  1 Stage is finished in the Main Protocol.
 
<TaskFinishing 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>
</TaskFinishing>
TaskFinished method output
The plugin returns a HookResults XML block in the sResultXML parameter of the TaskFinished method. For information about the structure and contents of this XML block, see “HookResults XML block” .
Example of TaskFinished 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 TaskFinished method. The plugin tells VWorks software to write the following Info-type message to the Main Log:
Place plate at PlatePad  1 Stage task is finished.
 
<HookResults>
<Results>
<HookResult ResultType='Log Message'
ResultValue='Place plate at PlatePad - 1 Stage task is finished.' />
</Results>
</HookResults>
Related information