VBScript scripts (script groups)
- Last UpdatedOct 29, 2026
- 2 minute read
A VBScript Script worksheet is used to implement program logic (using VBScript) that is continuously executed during runtime, rather than on specific actions like the user pressing a button on a screen.
Note: The Script worksheet is functionally similar to the Math worksheet, except that it uses VBScript instead of the Built-in Scripting Language.
To create a new Script worksheet:
Choose one of these options to create and open a new scripting worksheet for editing:
-
On the ribbon Insert tab Task Worksheets group, select Script, then choose the type of sheet on the menu: VBScript or Python.
-
In the Tasks tab of the Project Explorer, open the Script folder to access the VBScript and Python subfolders. Right-click the appropriate Script subfolder, VBScript or Python, and choose Insert on the context menu.
A new Script worksheet is opened in the Screen/Worksheet Editor.

To edit an existing Script worksheet:
-
In the VBScript subfolder in the Script folder in the Project Explorer Tasks tab, double-click the worksheet or right-click it and choose Open on the context menu.
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 (non-zero).
Note: The Execution field only supports syntax supported by the Built-in Scripting Language. Only the body of the worksheet supports VBScript.
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 (functions and subroutines) in the script worksheet. However, you can call procedures defined in the VBScript Global Procedures or in the VBScript Startup Script.
Example:
'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
Note: When any script worksheet is saved during runtime (on-line configuration), the Startup Script will be executed again and the current value of the local variables of any script worksheet will be reset.