Script worksheet
A Script worksheet is used to implement program logic (using VBScript) that should be continuously executed during runtime, rather than on specific actions like the user pressing a button on a screen.
- On the Insert tab of the ribbon, in the Task Worksheets group, click Script;
- Right-click the Script folder in the Project Explorer, and then click Insert on the shortcut menu; or
- Click New on the Application menu, click the File tab, and then select Script Worksheet.
To edit an existing Script worksheet, double-click it in the Project Explorer.
The code configured in each Script worksheet is executed by the Background Task. The project scans the worksheets sequentially (based on the worksheet number) and executes only the groups in which the condition configured in the Execution field of the worksheet is TRUE (i.e., non-zero).
Variables declared in the worksheet have local scope for that specific group only. They are not available for any other VBScript interface.
You cannot define procedures (i.e., functions and subs) in the Script worksheet. However, you can call procedures defined in the Global Procedures or in the Startup Script.
'Variables available only for this group can be declared here Dim myVar, myTest myTest = 1 'The code configured here is executed while the condition configured in the Execution field is TRUE myVar = $FindFile("c:*.txt") If MyVar > 0 Then $TagNumOfFiles = myVar End If