VWorks User Guide : Using macros to create protocols : Adding parameter variables and scripting to a macro

Adding parameter variables and scripting to a macro
About this topic
This topic describes the following:
This topic assumes that you have an understanding of how to create VWorks protocols, including how to do the following:
 
Adding macro parameter variables
You can expose parameters for individual tasks at the task macro level. For example, you might want to edit the parameter values of tasks contained in the macro without having to open the macro and then open each task to access the task parameters.
To add task parameter variables to the macro:
1
In the Available Macros tab, right-click the macro icon, and then choose Edit from the shortcut menu.
A macro editor tab opens in protocol area and displays the contents of the macro.
2
3
Click Add Variable. A row appears in the Variable Name table.
4
In the new row, click the Variable Name field, and then type the exact same JavaScript variable that appears in the Task Parameters area for the given task parameter.
For example, a macro contains multiple Wash Tips tasks for which you are using the same volume. In the corresponding Task Parameters for each task, you define the Volume parameter as a variable, such as =WashVol_. You use the same variable, WashVol_ as the variable name in the macro’s custom parameters. You can change the volume specified for both tasks by editing the variable value in the macro’s Custom Parameters area.
 
5
In the Initial Value field of the Custom Parameters area, type the value for variable.
For more details on using JavaScript variables for task parameters, see Using simple variables.
Filtering the macro parameters
To show all macro parameters:
In the Custom Parameters area, right-click the variables table, and select Show all.
To filter the macro parameter list:
1
In the Custom Parameters area, right-click the variables table, and select Show all.
2
 
Adding JavaScript to a macro
You can write JavaScript for a macro in a similar way that you can for a task. For example, you could enable a macro for one set of conditions and disable the macro for all other conditions using the task.skip()method.
At the macro level, you can use only the shared methods of the task object. For a description of the task object’s shared methods, see task object.
To add JavaScript to a macro:
1
In the Available Macros tab, right-click the macro icon, and then choose Edit from the shortcut menu.
A macro editor tab opens in protocol area and displays the contents of the macro.
Figure. Macro editor tab and the Advanced Settings area
 
2
3
Click Advanced Settings.
4
In the Script to be executed before task runs box, type your script.
Note: To view the list of available properties for the task object, type task. You can select a property from the list that appears.
Related information
 
VWorks JavaScript variables