Appendix: VBScript The following example causes a procedure called MyProc to execute 50 times. The For statement specifies the counter variable x and its start and end values. The Next statement increments the counter variable by 1. Sub DoMyProc50Times() Dim x For x = 1 To 50 MyProc Next End Sub Using the Step keyword, you can increase or decrease the counter variable by the value you specify. In the following example, the counter variable j is incremented by 2 each time the loop repeats. When the loop is finished, the total is the sum of 2, 4, 6, 8, and 10.
Sub TwosTotal() Dim j, total For j = 2 To 10 Step 2 total = total + j Next MsgBox "The total is " & total End Sub To decrease the counter variable, use a negative Step value. You must specify an end value that is less than the start value. In the following example, the counter variable myNum is decreased by 2 each time the loop repeats. When the loop is finished, the total is the sum of 16, 14, 12, 10, 8, 6, 4, and 2. Sub NewTotal() Dim myNum, total For myNum = 16 To 2 Step -2 total = total + myNum Next MsgBox "The total is " & total End Sub You can exit any For…Next statement before the counter reaches its end value by using the Exit For statement.
Because you usually want to exit only in certain situations, such as when an error occurs, you should use the Exit For statement in the True statement block of an If…Then…Else statement. If the condition is False , the loop runs as usual. Support for ActiveX Controls Using the VBScript interfaces for the Graphic module (Graphics Script, Screen Script, Command animation, and ActiveX Events), you can use this syntax to access properties and methods directly from any ActiveX Control object inserted in the screen where the object is configured. IWS will assign a unique name to the object on the screen. You can use the Name property (in the Object Properties dialog) to modify this name.
After inserting an ActiveX Control object on the screen, you can access properties and methods from this object from any VBScript interface associated with this screen. Use the syntax Object_Name . Properties_or_Method_Name . Examples: //Access the value of the property Day from the CalendarControl1 ActiveX object CalendarControl1.Day //Triggers the method AboutBox from the CalendarControl1 ActiveX object CalendarControl1.AboutBox Windows Embedded Support CEView also supports VBScript. The hardware manufacturer of the Microsoft Windows Embedded device must enable the support for VBScript on it, so CEView will be able to execute the scripts configured in VBScript language on the device.
The MsgBox() and InputBox() functions can be specifically enabled/disabled by the hardware manufacturer when the image for the Windows Embedded device is created. If you are not sure if the image loaded on your device supports VBScript, please consult the hardware manufacturer. InduSoft Web Studio Page 673