P1: JDT
WL040C-44 WL040/Bidgoli-Vol III-Ch-51 June 23, 2003 16:33 Char Count= 0
INTRODUCTION 621those performed using batch files in DOS and shell com-
mand scripts in UNIX.
VBScript is today most similar to VBA, but it is not
the same. VBScript is a return to an interpreted form of
the language, and like VBA, code written in VBScript is
designed to be processed and run in the context of an-
other application. The applications supporting VBScript
provide application-specific object models to give script
authors access to application functions, features, and
services. Unlike most VBA implementations, VBScript
implementations do not come with a built-in GUI author-
ing environment. VBScript applications are most often
created using simple word processing applications (e.g.,
Microsoft Notepad) or using multipurpose applications
such as Microsoft Visual InterDev. VBA also retains sev-
eral Visual Basic features not available in VBScript, most
notably optional strong data typing, more extensive er-
ror handling features, early binding options, and direct
access to certain low-level Windows objects and features
such as the clipboard and dynamic data exchange func-
tions. The latest releases of VBScript do include support
for regular expressions, something not yet intrinsic to
VBA.The Role of VBScript on the Internet
and Its Relation to Other Internet
Scripting Languages
For many purposes, VBScript may simply be thought of
as VBA for the Web. Certainly this appears to be the pri-
mary role initially envisioned for the language by Mi-
crosoft. It allows programmers versed in Visual Basic or
VBA to leverage their expertise and experience to quickly
create client-side and server-side Web applications. VB-
Script will run on Windows NT 4 and later, Windows 95
and later, Windows 2000, and Windows XP. However, be-
cause JavaScript had a head start as a client-side Web
programming language, because native support for VB-
Script applications has not yet been added to the Netscape
Web browser (while on the other hand, Microsoft Inter-
net Explorer does natively support the use of JavaScript
for client-side scripting), and because VBScript imposes
generally fewer “sandbox” (i.e., security) restrictions than
JavaScript, VBScript remains relatively less popular than
JavaScript for Web client-side implementations. Because
VBScript is not Web browser neutral, it is only useful
for client-side scripting in organization Intranet environ-
ments where steps can be taken to ensure that Microsoft
Internet Explorer is the browser used by those accessing
the site. When used in such a scenario, experienced Vi-
sual Basic and VBA developers have found that VBScript
does facilitate rapid development and implementation of
powerful client-side scripts. While not a hit for client-
side scripting, VBScript has proven extremely popular for
server-side Web applications built on top of Microsoft IIS.
ASP has shown itself flexible, robust, and better perform-
ing than nonscript approaches, and when used in conjunc-
tion with ASP, VBScript competes well with other script-
ing languages and scripting approaches.
The introduction of Windows Scripting Host in 1998
created a second important role for VBScript as the script-
ing language of the Windows operating system. Prior to1998 many DOS and UNIX programmers had bemoaned
the lack in Microsoft Windows of something truly equiv-
alent in power and scope to a full-featured batch mode
language or shell script language. Windows shortcuts and
PIF files did not provide sufficient in-depth access to the
operating system and its application programming in-
terfaces. With the introduction of the WSH, VBScript
now fills that void. VBScript allows programmers to write
scripts for browsing portions of the Windows file system,
bridging between Windows applications, and interacting
with network resources such as database servers. Unfor-
tunately such capability has come with a price. Many
of the most infamous e-mail computer virus attacks in-
volve the transmission and activation of VBScript files (file
extension .vbs). While Microsoft has added automatic
alerts and checks to warn users of potential problems
and attacks, inexperienced and unsophisticated users still
find themselves falling victim to such viruses all too
frequently. However, in the proper hands and for the
proper reasons, VBScript applications written to run in
the context of the WSH can be most useful, particu-
larly to accomplish quickly certain kinds of lightweight
tasks involving the operating system and associated
services.
For client-side Web applications JavaScript (or JScript
as implemented by Microsoft) is clearly the best alter-
native to VBScript. For most common client-side tasks,
e.g., Web form user input validation and manipulation,
user warnings and alerts, soliciting user input through
simple dialogs, and controlling Web browser windows,
both VBScript and JavaScript provide more than ade-
quate support. Both languages rely heavily on the World
Wide Web Consortium (W3C) document object model
(DOM). Both languages provide extensive support for
Web browser events (e.g., page load and form submit).
VBScript distinguishes itself from JavaScript mostly in
terms of greater functionality and ease of use when in-
tegrating external programming classes and objects and
accessing advanced client-side operating system features
and functions. When such high-level functionality is
required (and assuming there is assurance that the target
audience will be using Microsoft Internet Explorer),
VBScript is the better option.
For creating server-side Web applications using Mi-
crosoft IIS, there exist a number of alternatives to VB-
Script. Which one to use is largely a matter of per-
sonal preference. For example, IIS natively supports the
use of the JScript language in ASP applications. Mi-
crosoft has committed to ensuring equivalent server-side
script capability whether using VBScript or JScript. Af-
ter download and installation of appropriate third party
software (i.e., scripting engine), PerlScript or other lan-
guages also may be used instead of VBScript to code
ASP applications. There also are numerous alternatives
to ASP itself, including traditional Web common gate-
way interface (CGI) scripts (slower performance and
no built-in support for maintaining state), applications
that directly access Microsoft’s Internet service applica-
tion programming interface, and competing scripting-
based schemes now compatible with IIS such as PHP
tools and the Macromedia’s commercial ColdFusion MX
product.