Appendix: VBScript Function AreaEquTriangle(base, high) AreaEquTriangle = (base * high) / 2 End Function Sub CheckLimits(myValue, myHiLimit, myLoLimit) If (myValue > myHiLimit Or myValue 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 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. 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, do one of the following:
• 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. Script worksheet 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). Note:
You must use the syntax supported by the Built-in Scripting Language in the Execution field. 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 (i.e., functions and subs) in the Script worksheet. However, you can call procedures defined in the Global Procedures or in the 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 Page 650 InduSoft Web Studio