The VBScript Team
Updated: March 1996
VBScript is an upwardly compatible subset of the popular Microsoft Visual Basic® programming system. Its source implementation is licensed at no charge to interested software developers for inclusion with their products. Microsoft will provide binary implementations of VBScript for the 32-bit Windows® API, the 16-bit Windows API, and the Macintosh® in the first half of 1996. VBScript is tightly integrated into World Wide Web browsers, and is designed to work with OLE controls, applets, and other objects embedded in World Wide Web (HTML) documents; however, VBScript can also be used as a general automation language with other applications.
Microsoft has designed Visual Basic as a scalable development tool for Internet and Enterprise applications. There are a number of places where Visual Basic developers create value, including creating "active" HTML documents, customizing productivity products, and building client/server business applications.
To support these scenarios, Microsoft provides Visual Basic in three upwardly compatible packages:
This lightweight subset of Visual Basic will be licensed to industry companies and corporations free of charge. Microsoft will provide Visual Basic on Windows and Macintosh platforms, and is working with third parties to provide Unix® versions for Sun®, HP®, Digital, and IBM® platforms. VBScript is packaged as a compiler and associated run-time libraries. At this point, Microsoft does not provide integrated development support tools (editing, layout, debugging, and so on) for VBScript. Microsoft anticipates that this product will be available to licensees and other interested parties in the first half of 1996.
Visual Basic for Applications is Microsoft's strategic application scripting language. It is highly extensible using OLE Automation and other OLE-based mechanisms. It includes a complete development environment, including integrated editor and debugging support. Currently, Visual Basic for Applications is found only in the Microsoft Office family of products on Windows and the Macintosh.
The Visual Basic packaged development tool product comes in three editions: the Standard Edition for students and hobbyists, the Professional Edition for individual developers, and the Enterprise Edition for developers working in teams or in corporate settings. Visual Basic 4.0 provides a superset of the language and tool functionality in Visual Basic for Applications. Key features include client/server data access, distributed computing (for example, three-tier) support, and team source code control support. Currently, Visual Basic 4.0 is available only for Windows.
The MS-FTD Internet site enables users to order flowers. With VBScript support, MS-FTD makes this process easier for their customers an d for themselves. For example, date validation can be done on the client, thus reducing the use of network bandwidth, since there is no need to make a trip to the server and back to check that the date is valid. This makes things easier for the user and easier for MS-FTD.
VBScript is a component that is used by a host (such as an Internet browser or other application). Other vendors will certainly be interested in providing similar components. A host should not have to write special integration code to host multiple scripting components, so Microsoft plans to work with various Internet consortia to define an OLE scripting standard that allows scripting engines to be plug-compatible. This will be part of the Microsoft Internet Explorer, which will be made available to third parties at no cost.
We envision a world in which a host interacts with an "OLE scripting manager" using some interface, say IScriptManager. The scripting manager enables a host to compile scripts, obtain and call entry points, and manage the namespace available to the developer. With it, language vendors will be able to author pluggable language run times that enable Internet scripting. We will be providing run-time support for VBScript and Visual Basic.
This section briefly describes differences between VBScript and Visual Basic for Applications. The intent is to give the reader an idea of what the language is like, and provide enough information for getting started. A later document will describe the VBScript language more rigorously.
VBScript is a strict subset of Visual Basic for Applications. The best source of information on language syntax and semantics for Visual Basic for Applications is the Language Reference that comes with Visual Basic 4.0.
Category | Feature |
Arrays | Declaration (Dim, Static, etc.) LBound, UBound ReDim, Erase |
Assignment | = Let Set |
Comments | Using REM and ' |
Control flow | Do...Loop For...Next, For Each...Next While...Wend If...Then...Else |
Error trapping | On Error Resume Next Err object |
Literals | Empty Nothing Null True, False User-defined literals: -- 123.456; "Foo", etc. |
Miscellaneous | Line continuation character (_) Line separation character (:) |
Nonconforming identifiers | o.[My long method name] |
Operators | Arithmetic: -- +, -, *, /, \, ^, Mod -- Negation (-) -- String concatenation (&) Comparison: -- =, < >,, <,, >,, < =, > =, Is Logical: -- Not -- And, Or, Xor -- Eqv, Imp |
Options | Option Explicit |
Procedures | Declaring procedures: -- Function -- Sub Calling procedures: -- Call Exiting procedures: -- Exit Function -- Exit Sub Parameters for procedures: -- ByVal, ByRef. |
Variables | Procedure-level: -- Dim -- Static Module-level: -- Private, Dim |
Category | Feature |
Arrays | Option Base Declaring arrays with LBound < > 0 |
Calling DLLs | Declare |
Collection access using ! | MyCollection! Foo |
Conditional compilation | #Const #If...Then...#Else...#End If |
Control flow | DoEvents GoSub...Return GoTo Line numbers and labels On Error...GoTo Select Case |
Data types | Boolean Byte Currency Date Double Integer Long Object Single String Type suffixes (%, $, !, etc.) User-defined classes (no Me) |
Debugging | Debug.Print End Stop |
Error trapping | Erl, Error, Error$ On Error...Resume Resume, Resume Next |
File I/O | (Lots) |
Graphics | Cls, Circle, Line, Point, PSet, Scale Print, Spc, Tab |
Literals | User-defined literals: -- Based real numbers, such as 1.2345E+100 -- Dates, such as #4/7/69# -- Trailing type characters, e.g., &hFF& |
Named arguments | Use of named arguments in calling members, e.g., Call Foo (bar:= 4) |
Operators | Like |
Options | DefType Option Base Option Compare Option Private Module |
Procedures | Declaring procedures: -- Property Get/Let/Set -- Specifying Public/Private Exiting procedures: -- Exit Property Parameters for procedures: -- ParamArray -- Optional |
Strings | Fixed length strings Mid, LSet, RSet statements |
Structs | Type...End Type LSet, RSet |
Using classes | Dim x As New TypeName Set x = New TypeName
|
Variables and constants | Data types: -- Currency type -- CCur Module-level: -- Const -- Private, Dim -- Public, Global Procedure-level: -- Const |
This section briefly describes differences between the VBScript and Visual Basic for Applications run times. The intent is to give the reader an idea of what features the VBScript run time will have. A later document will describe the VBScript run time more rigorously.
The VBScript run time is a subset of the Visual Basic for Applications run time. The best source of information regarding run-time functionality is the Language Reference that comes with Visual Basic 4.0.
Category | Feature |
Arrays | Array function |
Conversion | Abs Asc, Chr CBool, CByte CDate, CDbl, CInt CLng, CSng, CStr CVErr DateSerial, DateValue Fix, Int, Sgn Hex, Oct |
Dates | Date function, Time function Day, Month, Weekday, Year Hour, Minute, Second Now TimeSerial, TimeValue |
Math | Atn, Cos, Sin, Tan Exp, Log, Sqr Randomize, Rnd |
Object | CreateObject |
Strings | Asc, AscB, AscW Chr, ChrB, ChrW Instr, InStrB Len, LenB LCase, UCase Left, Right LeftB, MidB, RightB Mid function Space(number) StrComp String(number, character) Trim, LTrim, RTrim |
UI | InputBox MsgBox |
Variant support | IsArray IsDate IsEmpty IsError IsNull IsNumeric IsObject VarType |
Category | Feature |
Clipboard | Clipboard object |
Collection | Add Count Item Remove |
Constants | (Lots) |
Conversion | Chr$, Hex$, Oct$ CVar, CVDate CCur Format, Format$ Str$ Str, Val |
Date/Time | Date statement, Time statement Date$, Time$ Timer |
DDE | LinkExecute LinkPoke LinkRequest LinkSend |
Financial | (Lots) |
Graphics | TextHeight, TextWidth LoadPicture, SavePicture QBColor, RGB |
Manipulating objects | Arrange, ZOrder, SetFocus InputBox$ Drag Hide, Show, Load, Unload, Move PrintForm, Refresh AddItem, RemoveItem |
Miscellaneous | Environ, Environ$ SendKeys Command, Command$ DoEvents AppActivate, Shell Beep |
Objects | GetObject |
Printing | TextHeight, TextWidth EndDoc, NewPage PrintForm |
Strings | LCase$, UCase$ LSet, RSet Space$, String$ Format, Format$ Left$, Mid$, Right$ Trim$, LTrim$, RTrim$ StrConv |
Types | TypeOf |
Using classes | TypeName |
Variant Support | IsMissing |
VBScript has three kinds of customers:
Disclaimer: This document is a preliminary description of the terms under which Microsoft will provide VBScript source and binary versions to third parties. Final terms may differ in material ways.
Binary (compiled) versions of the VBScript compiler and run time for Windows (Win 32® and Win16) and the Power Macintosh® will be downloadable from Microsoft's Internet site. These can be integrated into any browser or application using the OLE scripting interface defined by Microsoft and other ISVs. VBScript can be distributed freely with any application that makes use of its capabilities.
Microsoft will license the source of VBScript to any vendor to accomplish a port and/or integration of the product. In order to ensure interoperability of different VBScript applications, licenses for use of the source of VBScript does not include the right to modify the VBScript language definition as described by Microsoft in its reference implementation.
Products ported or created using the VBScript source may be distributed freely without payment to Microsoft. If licensees create a derivative work of VBScript, they must notify Microsoft and must clearly indicate to users of the product that such derivative work is a modified version and not the original Microsoft software. Further, licensees agree to license such modifications back to Microsoft at no charge for distribution to others.
Microsoft may require from time to time that licensees demonstrate compatibility of VBScript implementations on different platforms. This may be in the form of automated tests provided by Microsoft.
All licensees (that is, both binary and source licensees) must agree to include the following in the About box and in any printed or online documentation for their application:
This application uses Microsoft® Visual Basic® Scripting Edition (VBScript) from Microsoft Corporation.
Licensees must further agree that any reference to VBScript in their documentation or other product description information be made in an unambiguous way, acknowledging Microsoft's ownership of this technology.
These will be supported at the same level that Internet Explorer is today. Support for this comes out of the Personal Operating Systems team in Product Support Services.
There will be a per incident charge of $95 with support coming from the Windows SDK support team in Developer Support.
This will require a $40,000 Premier contract with support coming from the Strategic Customers and Products team in our Premier organization. No additional fee is charged.
When will VBScript be available?
We anticipate delivery of VBScript in the first half of 1996.
How will hardware manufacturers use VBScript?
VBScript can be used as a batch-automation language on any hardware platform. Hardware vendors may use VBScript to create value-added software for their platforms as well.
How will software designers use VBScript?
VBScript is a freely available automation language that any software vendor can incorporate into its product to provide scripting capability on any platform.
How does VBScript compare to Visual Basic?
VBScript does not include any of the Visual Basic development environment components (that is, the editor, debugger, project manager, or source code control). It has no ability to create user interfaces. All user interfaces manipulated by VBScript must be created as HTML pages, OLE objects, or applets. And, of course, VBScript is free.
Is VBScript safe?
Yes, potentially unsafe language operations have been removed from VBScript.