Appendix: VBScript Screen Events In addition to the Screen Script, you can configure logics using the Built-in Scripting Language for the On Open, While Open and On Close events for the screen (see the Screen Logic interface from the Screen Attributes dialog). If you configure the Screen Script (VBScript language) and the Screen Logic (Built-in Scripting Language), IWS will respect the following execution order: MsgBox and InputBox Functions The MsgBox() and InputBox() functions from the VBScript language allow you to display pop-up messages during runtime. These functions are synchronous.
When either one is executed, the remaining instructions from the code will not be executed before the pop-up messages launched by the functions are closed. Note: The text displayed in these pop-up messages are not affected by the Translation Tool of IWS, unless you configure the text explicitly using the $Ext() function from the Built-in Scripting Language. VBScript Procedures In VBScript, there are two kinds of procedures; the Sub procedure and the Function procedure. Sub Procedures A Sub procedure is a series of VBScript statements (enclosed by Sub and End Sub statements) that perform actions but don't return a value.
A Sub procedure can take arguments (constants, variables, or expressions that are passed by a calling procedure). If a Sub procedure has no arguments, its Sub statement must include an empty set of parentheses (). The following Sub procedure uses two intrinsic (built-in) VBScript functions, MsgBox and InputBox , to prompt a user for information. It then displays the results of a calculation based on that information. The calculation is performed in a Function procedure created with VBScript. The Function procedure is shown after the following discussion.
Sub ConvertTemp() temp = InputBox("Please enter the temperature in degrees F.", 1) MsgBox "The temperature is " & Celsius(temp) & " degrees C." End Sub Function Procedures A Function procedure is a series of VBScript statements enclosed by the Function and End Function statements. A Function procedure is similar to a Sub procedure, but can also return a value. A Function procedure can take arguments (constants, variables or expressions that are passed to it by a calling procedure). If a Function procedure has no arguments, its Function statement must include an empty set of parentheses. A Function returns a value by assigning a value to its name in one or more statements of the procedure.
The return type of a Function is always a Variant. In the following example, the Celsius function calculates degrees Celsius from degrees Fahrenheit. When the function is called from the ConvertTemp Sub procedure, a variable containing the argument value is InduSoft Web Studio Page 665 Category Omitted Feature/Keyword LSet, RSet Mid Statement StrConv Using Objects Collection access using !
Event Order of execution When opening the screen • Screen OnOpen() sub-routine from the Screen Script interface (VBScript language) _ • On Open from the Screen Logic interface (Built-in Scripting Language) When closing the screen • On Close from the Screen Logic interface (Built-in Scripting Language) • Screen OnClose() sub-routine from the Screen Script interface (VBScript language) _