18.01.2013 Views

VBScript Reference Manual for InduSoft Web Studio

VBScript Reference Manual for InduSoft Web Studio

VBScript Reference Manual for InduSoft Web Studio

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

<strong>VBScript</strong> <strong>Reference</strong> <strong>Manual</strong> <strong>InduSoft</strong> <strong>Web</strong> <strong>Studio</strong><br />

Const<br />

Description Declares constants <strong>for</strong> use in place of literal values<br />

Usage [Public | Private] Const constname = expression<br />

Arguments Public<br />

Optional. Keyword used at script level to declare constants that are available to all<br />

procedures in all scripts. Not allowed in procedures.<br />

Private<br />

Optional. Keyword used at script level to declare constants that are available only within the<br />

script where the declaration is made. Not allowed in procedures.<br />

constname<br />

Required. Name of the constant; follows standard variable naming conventions.<br />

expression<br />

Required. Literal or other constant, or any combination that includes all arithmetic or logical<br />

operators except Is.<br />

Remarks Constants are public by default. Within procedures, constants are always private; their visibility<br />

can't be changed. Within a script, the default visibility of a script-level constant can be changed<br />

using the Private keyword.<br />

To combine several constant declarations on the same line, separate each constant assignment<br />

with a comma. When constant declarations are combined in this way, the Public or Private<br />

keyword, if used, applies to all of them.<br />

You can't use variables, user-defined functions, or intrinsic <strong>VBScript</strong> functions (such as Chr) in<br />

constant declarations. By definition, they can't be constants. You also can't create a constant<br />

from any expression that involves an operator, that is, only simple constants are allowed.<br />

Constants declared in a Sub or Function procedure are local to that procedure. A constant<br />

declared outside a procedure is defined throughout the script in which it is declared. You can use<br />

constants anywhere you can use an expression.<br />

Example Const MyVar = 459 'Constants are Public by default.<br />

Private Const MyString = "HELP" 'Declare Private constant.<br />

Const MyStr = "Hello", MyNumber = 3.4567 ‘Declare multiple constants on same line.<br />

Dim<br />

Description Declares variables and allocates storage space<br />

Usage Dim varname[([subscripts])][, varname[([subscripts])]] . . .<br />

Arguments varname<br />

Name of the variable, following standard variable naming conventions<br />

subscripts<br />

Dimensions of an array variable, up to 60 multiple dimensions may be declared. The<br />

subscripts argument uses the following syntax: Upper[,upper]…<br />

The lower bound of an array is always zero.<br />

Remarks Variables declared with the Dim statement at the script level are available to all procedures within<br />

the script. Variables declared within a procedure are available only within the procedure.<br />

A Dim statement with empty parentheses declares a dynamic array, which can be<br />

defined later within a procedure using the ReDim statement.<br />

Returns N/A<br />

Example Dim counter ‘ Declare a variable<br />

Dim counter1, counter2 ‘ Declares two variables<br />

Dim item(9) ‘ Declares an array with 10 elements<br />

Dim item() ‘ Declares a dynamic array<br />

174 <strong>InduSoft</strong>, Ltd.

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!