Using Vbscript with Indusoft Web Studio
Total Page:16
File Type:pdf, Size:1020Kb
Using VBScript with InduSoft Web Studio © InduSoft 2006 Table of Contents About VBScript..............................................................................................................................................4 VBScript Limitations in IWS.........................................................................................................................6 The Microsoft Visual Basic Family...............................................................................................................6 Differences between VBScript and VBA ......................................................................................................7 VBScript Hosting Environments ...................................................................................................................8 VBScript Language Overview .......................................................................................................................9 VBScript Functionality ..............................................................................................................................9 VBScript Elements.....................................................................................................................................9 Variable Data Types and Subtypes ..........................................................................................................10 Data Subtype Identification......................................................................................................................10 Data Subtype Conversion.........................................................................................................................10 Variable Naming Rules & Conventions...................................................................................................11 Variable Scope .........................................................................................................................................11 VBScript Constants..................................................................................................................................11 Declaring VBScript Variables and Constants..........................................................................................12 VBScript Keywords .................................................................................................................................12 Operators..................................................................................................................................................12 Operator Precedence ................................................................................................................................13 Functions..................................................................................................................................................13 Statements ................................................................................................................................................16 Objects and Classes......................................................................................................................................19 VBScript Object Commands....................................................................................................................21 VBScript User-Defined Class Objects.....................................................................................................22 VBScript Objects and Collections ...........................................................................................................26 Err Object.............................................................................................................................................27 Scripting Dictionary Object .................................................................................................................28 Scripting FileSystemObject .................................................................................................................29 COM Objects and Collections .................................................................................................................36 VBScript Configuration and Operation in IWS...........................................................................................40 Global Procedures ....................................................................................................................................41 Graphics Script.........................................................................................................................................42 Screen Scripts...........................................................................................................................................43 Command Dynamic .................................................................................................................................45 ActiveX Events ........................................................................................................................................46 Background Task Startup Script ..............................................................................................................47 Background Task Script Groups ..............................................................................................................47 Scope of VBScript Procedures and Variables..........................................................................................49 Accessing IWS Tags and IWS Built-in functions....................................................................................50 Accessing ActiveX Objects from VBScript.............................................................................................53 IntelliSense...............................................................................................................................................54 IntelliSense...............................................................................................................................................55 VBScript with Web Thin Clients.............................................................................................................57 VBScript Language Reference.....................................................................................................................58 VBScript Variables ..................................................................................................................................59 Variable Data Types and Subtypes ......................................................................................................59 Array Variables ....................................................................................................................................61 Boolean Variables ................................................................................................................................63 2 Byte, Integer & Long Variables...........................................................................................................64 Currency Variables ..............................................................................................................................64 Date (and Time) Variables...................................................................................................................65 Empty Variables...................................................................................................................................67 Error Variables.....................................................................................................................................67 Null Variables ......................................................................................................................................67 Object Variables...................................................................................................................................68 Real (Single, Double) Variables ..........................................................................................................68 Strings Variables .................................................................................................................................69 Data Subtype Identification..................................................................................................................71 Data Subtype Conversion.....................................................................................................................73 Data Subtype Conversion.....................................................................................................................74 VBScript Naming Rules and Conventions...........................................................................................74 VBScript Naming Rules and Conventions...........................................................................................75 Variable Scope .....................................................................................................................................76 VBScript Constants..................................................................................................................................78 Explicit Constants ................................................................................................................................78 Implicit Constants ................................................................................................................................79