You have already seen that web browsers support a plain text syntax, known as HTML, for displaying information. HTML is a simple language and, as such, provides few mechanisms for extended interaction. Some controls, such as buttons, are supported intrinsically; however, more advanced user interface controls, such as spinners, calendars, and grids, are not implemented.
In an effort to provide a completely interactive environment, Microsoft has introduced a standard for including any scripting language within an HTML page. This standard is called ActiveX Scripting. ActiveX Scripting is a language-independent standard that defines the relationship between a scripting host and a scripting engine. A scripting engine is nothing more than an in-process ActiveX component, formerly called an OLE server, that conforms to the ActiveX Scripting specification. A scripting host is an application that uses the scripting engine. An example of a scripting host is the Microsoft Internet Explorer 3.0. ActiveX Scripting begins when an in-process ActiveX component representing the scripting engine is instantiated inside the process space of the Internet Explorer. After the scripting engine has been built by the Internet Explorer, it is loaded with commands for execution. The commands themselves, called the script, live inside the actual HTML page between the two tags <SCRIPT> and </SCRIPT>. After the script has been loaded into the engine, the Internet Explorer runs the script through the engine. This action results in the functionality defined by the commands in the code. Figure 2-1 shows the relationship between the scripting engine and the scripting host.
Figure 2-1.
ActiveX Scripting.
Microsoft Visual Basic, Scripting Edition, is implemented with the scripting engine named vbscript.dll. The VBScript engine and the Internet Explorer are not fundamentally joined; therefore, vbscript.dll can be used in any application that is an ActiveX scripting host. The VBScript engine understands the VBScript language, which is nothing more than a subset of the existing Visual Basic for Applications language. With the support of the Internet Explorer, VBScript can read and modify HTML form elements, perform event handling, interact with the browser, and automate any ActiveX component. We will cover the key features of the VBScript language later in this chapter.
KEY CONCEPT:VBScript is a proper subset of the Visual Basic for Applications language.