The Task file uses the XML file format with the extension.tsk. To learn more about the XML format, see http://www.w3schools.com/xml.
The following example presents the basic node, elements and attributes required for a .tsk file:
<Process type="TCL_PROC" name="MathTask" impl="MathTask.tcl" iconFile="MathTask.png">
<Param name="operation" type="string" value="ADD" />
<Input name="input_1" datatype="int" value="8" />
<Input name="input_2" datatype="int" value="13"/>
<Output name="output" datatype="int" />
</Process>
The following table explains the elements and attributes of the above .tsk file:
TSK File Element |
Attribute |
Valid Type |
Function of the XML Attribute Type |
---|---|---|---|
Process |
type= “TCL_PROC” |
TCL_PROC |
Specifies the language in which the task is authored. In this example the programming language is ITCL. |
name= “MathTask” |
user-defined |
Specifies the name of the task, which must be unique. This attribute is unique to the HyperWorks context. In this example the name of the Task file is MathTask. The names of all HW tasks are located in [ALTAIR_INSTALL]\hw\bin\win64\Packaging.xml |
|
impl= “MathTask.tcl” |
user-defined |
Points to the file that contains the implementation information for the task. In this example the execution logic is contained in the file: MathTask.tcl. Note: This file must be placed in the same location as the *.tsk file. |
|
Param |
name= “operation” |
user-defined |
Defines the variable name used in the Implementation Task file. The mapping between "name" and the implementation file is shown here. In this example the variable name defined is operation. |
datatype= “string” |
string int |
Specifies the data type of the variable. Valid types are: string, integer and double. In this example, the variable name is of type: string. |
|
value= “ADD” |
user-defined |
Assigns a default value to the variable. In this example the variable name is assigned a default value of “ADD”. |
|
Input |
name= “input_1” |
user-defined |
Defines the “variable name” that is used in the Implementation Task file. The mapping between “name” and the implementation file is shown here. In this example the “variable name” is defined as input_1. |
datatype = “int” |
string int double |
Specifies the type of variable. Valid types are: string, integer and double. In this example, the variable name is of type: int. |
|
value= “8” |
user-defined |
Assigns a default value to the variable. In this example the variable name is assigned a default value of 8. |
|
Output |
name= “output” |
user-defined |
Defines the variable name in the Implementation Task file. The mapping between “name” and the implementation file is shown here. In this example the variable name is defined as “output”. |
datatype = “int” |
string int double |
Defines the type of variable. The valid types are: string, integer and double. In this example the variable name is of type: int. Note: While default values can be specified as parameter input, the output is generated with the task that is executed. |
The following is an example of a Task file that contains entries for data type defined as input and output.
<Process type="TCL_PROC" name="MathTask" impl="MathTask.tcl" iconFile="MathTask.png">
<Param name="operation" type="string" value="ADD" />
<Input name="inputObject_1" datatype="intDataClass" datavalue="" />
<Input name="inputObject_2" datatype="intDataClass" datavalue="" />
<Output name="outputObject" datatype="intDataClass" />
</Process>
The table below explains the elements and attributes of the Task Implementation file (*.tcl):
TCL File Element |
Attribute |
Output |
Parameters |
---|---|---|---|
Input |
name= “InputObject_1” |
user-defined |
Defines the variable name used in the Task Implementation file. The mapping between “name” and the implementation file is shown here. In this example the variable name is defined as InputObject_1. |
datatype= “intDataClass” |
user-defined |
Defines the data type of the variable. Here the data type is intDataclass. Note that prior to loading a task, the ITCL class must be registered with HyperWorks Automate or sourced in the TCL interpreter. |
|
datavalue= “ ” |
"" |
This field is for internal use and must remain null. |
|
Output |
name= “outputObject” |
user-defined |
Defines the variable name used in the implementation file. The mapping between “name” and the implementation file is shown here. In this example the variable name is defined as outputObject. |
datatype= “intDataClass” |
user-defined |
Defines the data type of the variable. Here the data type is the class, intDataclass. Note that prior to Loading a task, the ITCL class must be registered with HyperWorks Automate or sourced in the TCL interpreter. |