Section 9.1. What Is WSH?

9.1. What Is WSH?

So what is WSH? A language? As the name implies, WSH " hosts " a language and provides a shell to run scripts in. Scripts can be created in the language of your choice (provided it's available).

By default, WSH supports VBScript and Jscript as available scripting languages. But other popular scripting languages, such as Perl, have been implemented in the WSH environment. (To obtain Perl, which many people regard as the most powerful and versatile scripting language available on any platform, visit http://www. activestate .com.)

The capabilities provided in WSH, such as network and registry access, are provided by ActiveX Component Object Model (COM) objects. A COM object is a component that performs one or more specific tasks . This may vary from something as simple as displaying a message to running large applications. All Office applications are COM objects and can be manipulated through WSH. Internet Explorer is also a COM object. WSH itself provides a number of COM objects, and there are also objects associated with some parts of the system, such as the filesystem. Other functionality provided by COM objects includes file access, messaging (email), and database access.

The ability to use COM objects opens a whole world of possibilities that were once available only in dedicated programming environments such as C++ or Visual Basic. Once an object is created, it exposes information and functionality to the programming environment (in this case, WSH). Think of an object as a black box that performs specific operations. The box exposes information and functionality through a predefined set of commands. Since WSH has implemented core functionality using COM objects, it doesn't rely on language-specific features; many of the concepts discussed in this chapter are applicable to any scripting language implemented through WSH.



Windows XP in a Nutshell
Windows XP in a Nutshell, Second Edition
ISBN: 0596009003
EAN: 2147483647
Year: 2003
Pages: 266

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net