[Previous] [Table of Contents] [Next]

The Scope of This Book

This book isn't a complete reference to all scripting-related topics—it's a primer that begins with simple step-by-step instructions. Also, because most power users and system administrators know a bit about batch and macro programming but aren't familiar with object-oriented programming, this book provides an introduction to using objects and programming in VBScript and JScript.

After reading this book, you should know what WSH is for, you should understand the basics of VBScript and JScript, and you should be able to write your own scripts using the methods and properties of objects that WSH provides.

You can read the book from cover to cover, but you don't have to. You can concentrate on the parts or the chapters that suit your level of interest or your immediate needs.

The book is divided into four parts. Part I, "Introduction to the World of Script Programming," deals with the basics. If you've never programmed, I recommend that you start by reading this part. Chapter 1 introduces WSH and explains how to execute scripts. You'll learn about various script engines, and you'll find out how to submit arguments to a script program, how to use switches, and how to set script properties. Chapter 2 introduces tools that simplify script development. You'll learn how to use script editors, how to install ActiveX controls, and how to debug a script. If you've never done any object-oriented programming, you should look at Chapter 3, which explains what objects, methods, properties, collections, and object models are. Chapter 4 introduces VBScript, and Chapter 5 introduces JScript.

Part II, "Interactive Scripting," explains how to write scripts to obtain user input and display the results in dialog boxes and forms. Chapter 6 introduces the methods and functions for viewing results in dialog boxes, including the Echo method, the VBScript MsgBox function, and the Popup method. Chapter 7 explains how to use WSH objects. The samples use the WScript object to read script and language properties, to examine arguments submitted to a script, and to access environment variables. You'll learn how to create and release object instances within a script and how to use the Run method to launch programs from a script. Chapter 8 explains how to use the VBScript InputBox function to create an input dialog box and how to extend JScript to compensate for the missing InputBox function. You'll see samples that use Microsoft Internet Explorer objects to extend your scripting capabilities. Chapter 9 goes further in explaining how to use Internet Explorer objects to create dialog boxes and input forms.

Part III, "Power Scripting," introduces more objects. Chapter 10 deals with using WSH scripts to manage shortcuts on your Windows Desktop and on the Start menu. Chapter 11 looks at advanced WSH tasks such as retrieving the user, domain, or computer name. It covers printer and drive mapping in networking environments and accessing the Windows Registry from WSH scripts. Chapter 12 explains how to use the FileSystemObject object to deal with drives, folders, and files. For example, you'll learn how to enumerate files and folders, query drive properties, and back up files using scripts. Chapter 13 covers WSH 2 features that allow you to delay script execution, play sound, and run several applications from a script. You'll learn how to switch an application window to the foreground and how to simulate keystrokes by using the SendKeys method. Chapter 14 offers a collection of script programming techniques, tips, and tricks. Among other tasks, you'll learn how to obtain the current path, shut down Windows, print, and use the Windows shell from a script.

Part IV, "Appendixes," contains two appendixes. Appendix A lists WSH resources you'll find on the Internet. Appendix B, on script security, includes timely and up-to-date information and strategies for making your Windows systems more secure against WSH script viruses.