The Internet Encyclopedia (Volume 3)

(coco) #1

P1: JDT


WL040C-44 WL040/Bidgoli-Vol III-Ch-51 June 23, 2003 16:33 Char Count= 0


Visual Basic Scripting Edition (VBScript)Visual Basic Scripting Edition (VBScript)


Timothy W. Cole,University of Illinois at Urbana-Champaign

Introduction 620
What VBScript Is and Where It Comes From 620
The Role of VBScript on the Internet and Its
Relation to Other Internet Scripting
Languages 621
How Microsoft Implements Scripting
Languages 622
VBScript Version History 622
VBScript Language Fundamentals 622
VBScript Variables, Constants, and Data Typing 622
Essential Language Elements 624
User-Defined Procedures 625
VBScript Coding Conventions 625
Objects in VBScript 626
Use of Objects in VBScript 626
Intrinsic Object Models 627

Windows Scripting Host Object Model 627
Internet Explorer Scripting Host Object Model 628
Advanced Features of VBScript 630
Windows Script Files 630
Remote Scripting 630
Windows Script Components 631
Script Encoding 631
Migrating from VBScript to the .NET Framework 631
.NET Programming Language Environment 631
How ASP.NET Generates Client-Side Script 633
Web Services 633
Conclusion 633
Glossary 634
Cross References 634
References 634

INTRODUCTION
What VBScript Is and Where It Comes From

BASIC, an acronym for beginner’s all-purpose instruction
code, was developed in 1964 at Dartmouth College by John
Kemeny and Thomas Kurtz. Less powerful, but simpler
and easier to learn than other high-level programming
languages extant at the time, BASIC was initially used as
a teaching tool for introducing undergraduates to the fun-
damentals of programming and programming languages.
Original BASIC lacks many flow control features of newer,
structured programming languages and relies heavily on
the use of “Go To” statements, a practice that tends to ad-
versely impact code brevity and clarity and that has since
been eschewed in more modern languages such as C++
and Java. Original BASIC does not provide good support
for modular authoring of applications (e.g., does not pro-
vide a way to distinguish between local and global vari-
ables and does not invoke external object classes). When
ported to the PC, BASIC was initially implemented as an
interpreted language (as opposed to a compiled language),
meaning that code was processed and interpreted sequen-
tially line-by-line at run time rather than precompiled into
an optimized machine-language executable or other in-
termediate low-level language form at some point in time
prior to first execution. This tended to adversely impact
performance.
BASIC language interpreters were the first commer-
cial products produced by the Microsoft Corporation, and
Microsoft BASIC language implementations were inte-
gral components of IBM DOS and Microsoft PC DOS
when introduced circa 1980. By the mid-1980s Microsoft
and others had significantly enhanced BASIC, introduc-
ing many structured programming concepts into the
language and making it more powerful and useful for
real-world application building. In 1985 Microsoft in-
troduced QuickBasic, which included a BASIC compiler,

making for better performance of applications written in
the language.
By 1988, as it was developing OS/2 and Microsoft
Windows version 3.1, Microsoft had begun work on a
Windows-style graphical user interface (GUI) for BASIC
code authoring and development. It was at this time that
Microsoft purchased from Alan Cooper the rights to Tri-
pod, an early prototype drag-and-drop shell well suited
for code authoring in the Windows GUI environment. Vi-
sual Basic version 1.0 was publicly introduced in 1991
at Windows World. Visual Basic also marked the initial
introduction into the language of several object-oriented
programming (OOP) concepts borrowed from C++ and
other OOP languages of the day. The object-oriented na-
ture of Visual Basic has continued to evolve since its in-
troduction to the point where Visual Basic.NET (effec-
tively Visual Basic version 7) can now be thought of as a
fully OOP language. Microsoft Access BASIC, a precursor
of Visual Basic for Applications (VBA), first appeared in
1992, only a year after the introduction of Visual Basic.
By the release of Office 97, VBA had become the com-
mon language used across Microsoft’s primary suite of
office productivity applications (e.g., Microsoft Word, Ex-
cel, and Access) and by a number of third party applica-
tions in lieu of or in addition to application-specific macro
languages.
Microsoft Visual Basic Scripting Edition (VBScript),
initially a subset of VBA, appeared with the 3.0 version re-
lease of Microsoft Internet Explorer in 1996. VBScript was
intended in this context as an alternative to JavaScript,
support for which previously had been introduced as part
of the Netscape Navigator Web browser. VBScript support
was later added to Microsoft Internet Information Server
(IIS), to Microsoft Outlook, and to the Windows operating
system itself (in the form of the Windows Scripting Host
[WSH]). This latter implementation allows programmers
to create VBScript code to perform functions similar to

620
Free download pdf