Tools

Overview

The Tools component creates a Tools object that provides utilities that enable you to easily add sophisticated functionality to your Web pages, including advanced form processing, random number generating, and file existence testing.

Code Tour

This example demonstrates several of the capabilities of the Tools object. This script first uses the FileExists method provided by the Tools object, which can be used to ascertain whether a given file exists or not. The example calls this method using one invalid file name and one valid file name (the file name of the script itself).

The Random method of the Tools object is shown in the second half the script. Random, when called, returns a random value between -32767 and +32767. This sample demonstrates several ways in which the output can be made even more useful, using the Abs function to allow only positive numbers, or using the Mod operator to generate numbers between 1 and 100.

Location

The VBScript and JScript versions of this script are available in the IIS samples directory, at ...\asp\components\Tools_VBScript.asp and ...\asp\components\Tools_JScript.asp.