Startup Script worksheet

The Startup Script worksheet is a VBScript interface that is automatically executed when the project is run.

To edit the Startup Script worksheet, double-click it in the Project Explorer. (It is located on the Tasks tab, in the Script folder.) The worksheet is displayed:
Figure 1. Startup Script worksheet

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