VBScript Startup Script
- Last UpdatedOct 29, 2026
- 2 minute read
The Startup Script worksheet is a VBScript interface that is automatically executed when the project is run.
To edit the Startup Script worksheet:
-
In the VBScript subfolder in the Script folder in the Project Explorer Tasks tab, double-click the Startup Script worksheet or right-click it and choose Open on the context menu.
-
The worksheet is displayed:

The code configured in this worksheet is executed just once when the Background Task module (BGTask) is started. This interface is useful for initializing variables or executing logics that must be implemented when the project is run.
You can declare and initialize variables and define procedures. However, variables or procedures declared in this interface will be available ONLY to the Script worksheets executed by the Background Task module — they are not available to any VBScript interface from the Graphic Module.
Example:
'Variables available for all Script groups from the Script task can be declared and initialized here
Dim MyVar, Counter
MyVar = 100
'Procedures available for all Script groups from the Script task can be implemented here
Function AreaEquTriangle(base, high)
AreaEquTriangle = (base * high) / 2
End Function
Sub CheckLimits(myValue, myHiLimit, myLoLimit)
If (myValue > myHiLimit Or myValue < myLoLimit) Then
MsgBox("Value out of range")
End If
End Sub
'The code configured here is executed just once when the Background task is started
If $GetOS() = 3 Then
MsgBox ("Welcome! This project is running under Microsoft Windows Embedded operating system.")
Else
MsgBox("Welcome! This project Is running under Microsoft Windows desktop operating system.")
End If