18.01.2015 Views

Technical Reference Manual - InduSoft

Technical Reference Manual - InduSoft

Technical Reference Manual - InduSoft

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

Background Tasks<br />

Startup Script worksheet<br />

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

To edit the Startup Script worksheet, double-click it in the Project Explorer. (It is located on the Tasks tab, in<br />

the Script folder.) The worksheet is displayed:<br />

Startup Script worksheet<br />

The code configured in this worksheet is executed just once when the Background Task module (BGTask) is<br />

started. This interface is useful for initializing variables or executing logics that must be implemented when<br />

the project is run.<br />

You can declare and initialize variables and define procedures. However, variables or procedures declared in<br />

this interface will be available ONLY to the Script worksheets executed by the Background Task module —<br />

they are not available to any VBScript interface from the Graphic Module.<br />

Example:<br />

'Variables available for all Script groups from the Script task can be declared and<br />

initialized here<br />

Dim MyVar, Counter<br />

MyVar = 100<br />

'Procedures available for all Script groups from the Script task can be implemented<br />

here<br />

Function AreaEquTriangle(base, high)<br />

AreaEquTriangle = (base * high) / 2<br />

End Function<br />

Sub CheckLimits(myValue, myHiLimit, myLoLimit)<br />

If (myValue > myHiLimit Or myValue < myLoLimit) Then<br />

MsgBox("Value out of range")<br />

End If<br />

End Sub<br />

'The code configured here is executed just once when the Background task is started<br />

If $GetOS() = 3 Then<br />

MsgBox ("Welcome! This project is running under Microsoft Windows Embedded operating<br />

system.")<br />

Else<br />

MsgBox("Welcome! This project Is running under Microsoft Windows desktop operating<br />

system.")<br />

End If<br />

<strong>InduSoft</strong> Web Studio Page 317

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!