VBScript Reference Manual for InduSoft Web Studio
VBScript Reference Manual for InduSoft Web Studio
VBScript Reference Manual for InduSoft Web Studio
Create successful ePaper yourself
Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.
<strong>InduSoft</strong> <strong>Web</strong> <strong>Studio</strong> <strong>VBScript</strong> <strong>Reference</strong> <strong>Manual</strong><br />
Variable Naming Rules & Conventions<br />
<strong>VBScript</strong> has four primary rules <strong>for</strong> naming. These are:<br />
1. Variable names must begin with an alpha character (a..z, A...Z) or an underscore character<br />
2. After the first character, the variable name can contain letters, digits and underscores<br />
3. Variable names must be less than 255 characters in length<br />
4. The variable name must be unique in the scope in which they are declared<br />
<strong>VBScript</strong> variable names are not case sensitive. Microsoft recommends following their naming<br />
convention <strong>for</strong> variables, which puts attaches different prefixes to the variable name based on the data<br />
subtype.<br />
Variable Scope<br />
Variables have “scope” which defines a variable’s visibility or accessibility from one procedure (or<br />
<strong>VBScript</strong> Interface) to another, which is principally determined by where you declare the variable.<br />
Generally, when you declare a variable within a procedure, only code within that procedure can access<br />
or change the value of that variable. This is called local scope and is <strong>for</strong> a procedure-level variable.<br />
If you declare a variable outside a procedure, you make it recognizable to all the procedures in your<br />
Script. This is a Script-level variable, and it has Script-level scope. However, as previously noted,<br />
<strong>InduSoft</strong> en<strong>for</strong>ces certain restrictions on the scope of Variables and Procedures.<br />
<strong>VBScript</strong> Constants<br />
<strong>VBScript</strong> supports both explicit and implicit constants. Constants should never be used as variable<br />
names.<br />
Explicit constants are defined by the programmer. Explicit constants have a defined value which, unlike<br />
a variable, is not allowed to change during the life of the script.<br />
Implicit constants are pre-defined by <strong>VBScript</strong>. <strong>VBScript</strong> implicit constants usually begin with a vb<br />
prefix. <strong>VBScript</strong> implicit constants are available to the <strong>VBScript</strong> programmer without having to define<br />
them. Other objects, such as those used by ADO.NET, also have implicit constants predefined, usually<br />
with different prefixes. However, the implicit constants <strong>for</strong> these objects may not be know to <strong>VBScript</strong><br />
and if not, will have to be defined as an explicit constant.<br />
<strong>VBScript</strong> defines the following categories of implicit Constants:<br />
Intrinsic Constant Category Intrinsic Constant Category<br />
Color Constants File Attribute Constants<br />
Comparison Constants File Input/Output Constants<br />
Date and Time Constants MsgBox Constants<br />
Date Format Constants MsgBox Function Constants<br />
Days of Week Constants SpecialFolder Constants<br />
New Years Week Constants String Constants<br />
Error Constants Tristate Constants<br />
<strong>VBScript</strong> Runtime Errors VarType Constants<br />
<strong>VBScript</strong> Syntax Errors Locale ID (LCID)<br />
<strong>InduSoft</strong>, Ltd. 13