Microsoft Internet Security and Acceleration Server 2000

Using Enumerated Types in Scripts

Unlike Visual Basic or Microsoft Visual C++®, scripting languages, such as Visual Basic Scripting Edition (VBScript) or JScript®, do not support the use of enumerated values.

For this reason the ISA SDK includes two files that define as constants the enumerated values used in ISA.

The file fpccfg.vbs defines enumerated values in VBScript format.

The file fpccfg.js defines enumerated values in JScript format.

To use enumerated types when composing VBScript or JScript script files, copy the relevant constant definitions from the relevant fpccfg file to the constant declarations in your code.

For example, include the following code in the declarations section of your script:

const fpcRuleActionDeny = 1
const fpcAppliesToAll = 0
const fpcAppliesToAllContent = 0
const fpcSpecifiedDestinationSet = 3
const fpcArrayScope = 0

The declaration of constants allows you to write the following:

Set rules = array1.ArrayPolicy.SiteAndContentRules
Set rule = rules.Add("myrule")
rule.Action = fpcRuleActionDeny
rule.AppliesToMethod = fpcAppliesToAll
rule.AppliesToContentMethod = fpcAppliesToAllContent
rule.SetAppliesAlways
rule.SetDestination fpcSpecifiedDestinationSet, "Emergency", fpcArrayScope

If you always declare the appropriate constants in your declarations section at the beginning of each script, you can use enumerated types as you use them in C++ programs.

Alternatively, you can achieve the same effect by hard coding the values, as shown in the following code:

Set rules = array1.ArrayPolicy.SiteAndContentRules
Set rule = rules.Add("myrule")
rule.Action = 1
rule.AppliesToMethod = 0
rule.AppliesToContentMethod = 0
rule.SetAppliesAlways
rule.SetDestination 3, "Emergency", 0

These lines will perform the same task as the previous code lines, without the use of enumerated types.

When composing Windows Script (WS) or Windows Script File (WSF), which are Windows Script Host files, or when embedding scripts in HTML files, the constants files can be included by using the following statement (JScript example shown):

<script language="JScript" src="fpccfg.JS">

For more information about Windows Script Host, see the MSDN library.