Team LiB VBScript Programmer's Reference, Second Edition ISBN:0764559931 by Adrian Kingsley-Hughes, Kathie Kingsley-Hughes and Daniel Read Wrox Press © 2004 (720 pages) This edition combines a comprehensive overview of the VBScript technology and associated technologies with practical examples at every stage from beginner to advanced user Table of Contents VBScript Programmer’s Reference, Second Edition Introduction C hapter - A Quick Introduction to Programming C hapter - What VBScript Is—and Isn’t! C hapter - Data Types C hapter - Variables and Procedures C hapter - C ontrol of Flow C hapter - Error Handling and Debugging C hapter - The Scripting Runtime Objects C hapter - C lasses in VBScript (Writing Your Own C OM Objects) C hapter - Regular Expressions C hapter 10 - C lient-Side Web Scripting C hapter 11 - Super-C harged C lient-Side Scripting C hapter 12 - Windows Script Host C hapter 13 - Windows Script C omponents C hapter 14 - Script Encoding C hapter 15 - Remote Scripting C hapter 16 - HTML Applications C hapter 17 - Server-Side Web Scripting C hapter 18 - Adding VBScript to Your VB Applications Appendix A - VBScript Functions and Keywords Appendix B - Variable Naming C onvention Appendix C - C oding C onvention Appendix D - Visual Basic C onstants Supported in VBScript Appendix E - VBScript Error C odes and the Err Object Appendix F - The Scripting Runtime Library Object Reference Appendix G - The Windows Script Host Object Model Appendix H - Regular Expressions Appendix I - VBScript Features not in VBA Appendix J - VBA Features not in VBScript Appendix K - The Variant Subtypes Appendix L - ActiveX Data Objects Index List of Figures Team LiB Team LiB Back Cover The VBScript standard has changed over time, and several new things have been introduced since this book first published in 1999 The current standard for VBScript is 5.6 The script debugger, script control, and script encoder have all changed and the Windows Script C omponent Wizard, regular expressions, and remote scripting have been introduced Windows Script Host technology has also matured over time and gained in both effectiveness and popularity VBScript Programmer's Reference, 2nd Edition begins with discussion of the general syntax, functions, keywords, style, error handling, and similar languagespecific topics and then moves into an expanded reference section covering the object models in detail The book combines a comprehensive overview of the VBScript technology and associated technologies with practical examples at every stage from beginner to advanced user Specific topics include the following: Variables and Data Types Procedures Error Handling and Debugging Windows Script C omponents Script Encoding Remote Scripting Data Objects C oding C onventions About the Authors Adrian Kingsley-Hughes has made his living as a technology writer for the last six years, with many books and articles to his name He can also be found teaching classes on the Web, where he has successfully taught technology skills to thousands of learners Kathie Kingsley-Hughes has worked in IT training for many years In addition to writing, she now works as a courseware developer and e-trainer, specializing in Internet technologies She also runs a Web development company in the United Kingdom Daniel Read is a software developer living and working in Atlanta, GA, USA He currently works for C onnecture Inc., an Atlanta-based software consulting firm specializing in the insurance industry Daniel also publishes and writes essays for developer.*, a Web-based magazine for software professionals Team LiB Team LiB VBScript Programmer's Reference, Second Edition Adrian Kingsley-Hughes Kathie Kingsley-Hughes Daniel Read VBScript Programmer's Reference, Second Edition Published by Wiley Publishing, Inc 10475 Crosspoint Boulevard Indianapolis, IN 46256 www.wiley.com Copyright © 2004 by John Wiley & Sons All rights reserved Published simultaneously in Canada No part of this publication may be reproduced, stored in a retrieval system, or transmitted in any form or by any means, electronic, mechanical, photocopying, recording, scanning, or otherwise, except as permitted under Section 107 or 108 of the 1976 United States Copyright Act, without either the prior written permission of the Publisher, or authorization through payment of the appropriate per-copy fee to the Copyright Clearance Center, Inc., 222 Rosewood Drive, Danvers, MA 01923, (978) 750-8400, fax (978) 646-8700 Requests to the Publisher for permission should be addressed to the Legal Department, Wiley Publishing, Inc., 10475 Crosspoint Blvd., Indianapolis, IN 46256, (317) 572-3447, fax (317) 572-4447, Email:permcoordinator@wiley.com LIMIT OF LIABILITY/DISCLAIMER OF WARRANTY: THE PUBLISHER AND THE AUTHOR MAKE NO REPRESENTATIONS OR WARRANTIES WITH RESPECT TO THE ACCURACY OR COMPLETENESS OF THE CONTENTS OF THIS WORK AND SPECIFICALLY DISCLAIM ALL WARRANTIES, INCLUDING WITHOUT LIMITATION WARRANTIES OF FITNESS FOR A PARTICULAR PURPOSE NO WARRANTY MAY BE CREATED OR EXTENDED BY SALES OR PROMOTIONAL MATERIALS THE ADVICE AND STRATEGIES CONTAINED HEREIN MAY NOT BE SUITABLE FOR EVERY SITUATION THIS WORK IS SOLD WITH THE UNDERSTANDING THAT THE PUBLISHER IS NOT ENGAGED IN RENDERING LEGAL, ACCOUNTING, OR OTHER PROFESSIONAL SERVICES IF PROFESSIONAL ASSISTANCE IS REQUIRED, THE SERVICES OF A COMPETENT PROFESSIONAL PERSON SHOULD BE SOUGHT NEITHER THE PUBLISHER NOT THE AUTHOR SHALL BE LIABLE FOR DAMAGES ARISING HEREFROM THE FACT THAT AN ORGANIZATION OR WEB SITE IS REFERRED TO IN THIS WORK AS A CITATION AND/OR A POTENTIAL SOURCE OF FURTHER INFORMATION DOES NOT MEAN THAT THE AUTHOR OR THE PUBLISHER ENDORSES THE INFORMATION THE ORGANIZATION OR WEB SITE MAY PROVIDE OR RECOMMENDATIONS IT MAY MAKE FURTHER, READERS SHOULD BE AWARE THAT INTERNET WEB SITES LISTED IN THIS WORK MAY HAVE CHANGED OR DISAPPEARED BETWEEN WHEN THIS WORK WAS WRITTEN AND WHEN IT IS READ For general information on our other products and services please contact our Customer Care Department within the United States at (800) 762-2974, outside the United States at (317) 5723993 or fax (317) 572-4002 Trademarks: Wiley, the Wiley Publishing logo, Wrox, the Wrox logo, and Programmer to Programmer are trademarks or registered trademarks of John Wiley & Sons, Inc and/or its affiliates All other trademarks are the property of their respective owners Wiley Publishing, Inc., is not associated with any product or vendor mentioned in this book Wiley also publishes its books in a variety of electronic formats Some content that appears in print may not be available in electronic books Library of Congress Card Number: ISBN: 0-7645-5993-1 Printed in the United States of America 10 9 Library of Congress Cataloging-in-Publication Data Kingsley-Hughes, Adrian VBScript programmer's reference / Adrian Kingsley-Hughes, Kathie Kingsley-Hughes, Daniel Read.-2nd ed p cm Includes index ISBN 0-7645-5993-1 (paper/website) VBScript (Computer program language) HTML (Document markup language) World Wide Web I Kingsley-Hughes, Kathie II Read, Daniel, 1969- III Title QA76.73.V27K56 2004 005.2'762-dc22 2004007671 To my kids-you guys are great! -Adrian To my parents, for their loving support and enduring patience And to my kids, for being just so cool! -Kathie About the Authors Adrian Kingsley-Hughes Adrian Kingsley-Hughes has made his living as a technology writer for the last six years, with many books and articles to his name He can also be found teaching classes on the Web, where he has successfully taught technology skills to thousands of learners, with his own special brand of knowledge, experience, wit, and poor spelling Kathie Kingsley-Hughes Kathie Kingsley-Hughes has worked in IT training for many years In addition to writing, she now works as a courseware developer and e-trainer, specializing in Internet technologies She also runs a Web development company in the United Kingdom Daniel Read Daniel Read is a software developer living and working in Atlanta, GA, USA He currently works for Connecture Inc., an Atlanta-based software consulting firm specializing in the insurance industry Daniel also publishes and writes essays for developer.*, a Web-based magazine for software professionals (DeveloperDotStar.com) Credits Vice President and Executive Group Publisher Editorial Manager Richard Swadley Kathryn A Malm Vice President and Executive Publisher Senior Production Editor Bob Ipsen Fred Bernardi Vice President and Publisher Development Editor Joseph B Wikert Eileen Bien Calabro Executive Editorial Director Production Editor Mary Bednarek Felicia Robinson Acquisitions Editor Technical Reviewer Katie Mohr Wiley-Dreamtech India Pvt Ltd Acknowledgments A book is hard work, and a second edition even harder! The process involves a lot more people than just those listed on the cover My sincerest thanks goes out to everyone who made this book possible, from the first idea of a second edition through to getting it onto the shelves -Adrian Many thanks to family, friends, and colleagues, who have been very supportive during the writing of this book A big thank you to all the editors, tech reviewers, and production staff who worked so hard on this edition -Kathie I thank my fellow authors Adrian and Kathie and also the fine editorial staff at Wiley/WROX -Daniel Team LiB Team LiB Introduction Overview Imagine having the ability to write code quickly and easily in a text editor without having to worry about complex development environments Imagine not having the hassles of compiling code or distributing complex set-up programs Imagine being able to deploy your code in a wide variety of ways Imagine learning one language that allows you to code for server-side Internet, client-side Internet, and desktop Stop imagining VBScript gives you all this and much more VBScript is an absolutely superb language to be able to 'speak' in It's quick and easy to learn, powerful, flexible, and cheap This makes it a winning language for both experienced programmers and those starting out in their programming careers If you are an experienced programmer you can enjoy writing code free from complex development environments and the need for compiling On the other hand, if you are a beginner you can get started programming, needing nothing more than a little knowledge and a text editor Knowledge and experience in VBScript can open many technology doors too Having a good grounding in VBScript can lead you into areas such as Internet development, network administration, server-side coding, and even other programming languages (Visual Basic being the most popular route to take because the languages are so similar in syntax) With VBScript you can also create applications that look and feel like programs written using complex programming languages, such as C++ Also worth bearing in mind is that support for scripting is now embedded into every installation of the newer Windows operating systems-a dormant power that you can tap into with VBScript know-how By writing some simple script in a text editor you can a variety of tasks-such as copy and move files, create folders and files, modify the Windows registry, and lots more One easy-to-use scripting language can it all We believe that VBScript is a skill that many people will find both useful and rewarding, no matter whether they are involved in the IT industry, a SOHO PC user, a student, or simply a home user Knowing and using VBScript can save you time and, more importantly, money Team LiB Team LiB Who This Book Is For This book is the one-stop book for anyone who is interested in learning VBScript How you use it depends on your previous programming/scripting knowledge and experience: If you are a complete beginner who has heard about VBScript and have come this far, it's great You've come to the best possible place As a beginner you have a fascinating journey ahead of you We suggest that you go through this book from cover to cover to get the best from it If you already have IT and programming experience and want to learn VBScript (perhaps for Active Server Pages (ASP) or Windows Scripting Host (WSH)) then you too have come to the right place Your background in programming will mean that you will already be familiar with most of the terms and techniques we will be covering here For you, the task of learning another language is made simpler by this If you know what you plan of using VBScript for (say ASP or WSH), then you can read with this in mind and skip certain chapters for speed Network administrators are likely to find this book not only useful, but also an enormous timesaver because they can use VBScript to write powerful logon scripts or automate boring, repetitive, time-consuming, and error-prone tasks using WSH You're already using VBScript and just want to fill some of the blanks or bought this new edition just to keep right up to date You will no doubt find new information and you might want to read certain chapters more than others Team LiB Team LiB What This Book Covers As you'd expect, a book on VBScript covers VBScript To be precise, this book covers VBScript right up to the latest version (version 5.6) However, VBScript is a tool that can be used in a variety of different ways and by a variety of different applications Therefore, along with covering VBScript in detail, this book also covers technologies that are linked to and associated with VBScript These include technologies such as server-side technologies like Active Server Pages (ASP), client-side Dynamic HTML (DHTML), and Windows Script Host (WSH) Likewise, if you come from a Visual Basic background then most of what we will cover in the first third of the book (variables, data types, procedures, flow control, and so on) will be familiar to you We'll also show you how to get deep into the Windows operating system and make changes with just a few lines of code Team LiB Team LiB How This Book Is Structured Take a quick look at the table of contents of this edition and you will see that it is broken up into three broad sections: First, the book begins with chapters that are core VBScript-basically how VBScript works as a language Second, the book looks at how to make use of VBScript within other technologies (such as WSH or ASP) These chapters look at more advanced examples of VBScript code in action Finally, the book has a detailed and comprehensive reference section in the form of a series of appendices This reference section can be used either as a standalone reference section or to give you greater insight into how the VBScript from earlier chapters works How you decide to progress through the book really depends on your current skill level with regards to VBScript or other programming languages and what you want to If you want to use VBScript client-side on the Web then you can; if you want, skip any or all chapters relating to server-side VBScript On the other hand you might be a server-side developer and not be currently interested in client-side VBScript Again, that's just fine It's your book-use it the way that is best for you If you're not sure as to the best way to approach this book, we suggest that you read it from beginning to end, so that you benefit fully Don't worry too much about actually remembering everything you read-that's not the point The book is a reference, which means you can refer back to it again and again Make notes in the book as you go along, as this will help you remember better and also help you to find key parts you've read before Team LiB Team LiB What You Need to Use This Book VBScript is possibly a low-cost solution to many of your scripting/programming needs The good news is that if you (and your end users) use a Microsoft Windows operating system, you already have everything you need to be able to make full use of this book (or you can go online to download it) All the code writing that you will be doing can be done using the Windows Notepad application that you already have installed We will make a few suggestions as to other tools you can use that may make life easier for you, but a text editor is all you really need The Microsoft Scripting Web site contains documentation relating to VBScript that is available for download You may like to download these too to augment your reading here If you are not using Windows XP you might want to download the latest VBScript engine-point your browser at http://www.microsoft.com/scripting Team LiB Team LiB Conventions To help you get the most from the text and keep track of what's happening, we've used a number of conventions throughout the book Note Boxes like this one hold important, not-to-be forgotten information that is directly relevant to the surrounding text Tip Tips, hints, tricks, and asides to the current discussion are offset and placed in italics like this As for styles in the text: We highlight important words when we introduce them We show keyboard strokes like this: Ctrl+A We show file names, URLs, and code within the text like so: persistence.properties We present code in two different ways: In code examples we highlight new and important code with a gray background The gray highlighting is not used for code that's less important in the present context, or has been shown before Team LiB strType, data types of REG_BINARY, 336 REG_DWORD, 336 REG_EXPAND_SZ, 336 REG_SZ, 336 strUserName argument, 84, 86 strWorkingDirectory, 358 Style object, 293 Sub keyword, 83, 84 Sub…End Sub statement, 201 subprocedure, 20 subscript, 71 substitute good variable names for bad ones, 405 subtypes, 47, 78 Empty, 78 Null, 78 Object, 78 subtypes, types of Empty, 61 Null, 61 super-charged client-side scripting, overview of, 277 Synchronously, 408 syntax errors in VBScript, 583 syntax errors, 33, 126 syntax errors, cause of, 127 syntax issues, sysMenu property, 426 system configuration, 25 system design, Team LiB Team LiB Index T tagName property, 274 tags of ASP, 442 TargetPath property, 329, 356, 360 TCP/IP protocol, 436 technologies that implement behaviors binary behaviors, 292 HTCs…HTML components, 292 Telnet, 437 temporary storage area, temporary test code, inserting, 154 Test method, 238, 239 TEST_CONST, 213 testing for and coercing subtypes, 47 TestVBScriptFolder method, 192 text editor listing, 40 text file reading, 192 writing, 195 TextStream object methods, 608 properties, 607 TextStream.AtEndOfStream property, 118 TextStream.ReadLine() method, 118 TextStream.WriteLine() method, 195 Then keyword, 126 thePara variable, 274 theRow variable, 274 theTable variable, 274 theWindow variable, 274 three different ways to add Dictionary object, 184 Timeout event, 479, 490 Toggle Breakpoint option, 166 tombstone comments, 573 tools for VBScript, 40 tools of the trade, 249, 308 ActiveX Scripting engine, 308 text editor, 308 WSH engine, 308 tools required for creating HTAs, 416 tools required for WSH development, 307 top-down and event driven models, differences between, 23 top-down programs, significance of, 23 top-down style code, 24 top-down style programs, writing, 23 top-down versus event-driven, 23 Topframe.htm, 272 TotalBytes property, 450 Transfer method, 460 Trim$() function, 65 Trim() function, 65 Trim(Null) function, 65 tristate constants TristateFalse, 579 TristateTrue, 579 TristateUseDefault, 579 trouble with implicit type coercion, avoiding, 58 TryAgain variable, 14, 15 two-dimensional array, 69 type coercion, 47 type libraries, 380 Type statement, 77 TypeName() function, 57, 218 Team LiB Team LiB Index U UBound() function, 75 UCase() function, 65 UDT variables, 77 universal data type, 44 Universal Naming Convention (UNC), 347 Universal Resource Indicator (URI), 245 Unix Shell scripting, 37 Unnamed property, 343 unsupported array functions and statements, 528 unsupported conversion functions Cvar, 552 CVDate, 552 Str, 552 Val, 552 unsupported date and time functions and statements Date, 524 Time, 524 unsupported operators, 508 unsupported string functions and statements Format, 545 Mid (statement), 545 StrConv, 545 unsupported string functions, statements, and construct, 544 Until statement, 120 URL, 163 URLEncode() method, 460 User Defined Types (UDTs), 77 user interface, 24 UserDomain property, 345 UserName property, 345 users and change password, adding and removing, 308 using VBScript, advantages of good platform coverage, 34 implement VBScript in applications, 35 Team LiB Team LiB Index V ValidInteger function, 263 value entry, parts of Data type, 334 Name, 334 Value, 334 Value property, 243 value, returning, 83 values from methods, retrieving, 304 variable declaration and scope, 90 variable declaration, 45 variable lifetime, 90, 92, 178 variable naming convention, 569 variable scope, 90 variable, 43 variables and data types, variables and procedures, overview of, 79 variables, declaring Dim, 91 Private, 91 Public, 91 variables, naming, 81 Variant data type, 46, 47, 216 Variant subtypes, 46, 51 Variant value, 63 Variant variables, 47, 77, 204 Variant, VBScript's only data type, 46 varInput variable, 59 varTest variable, 50 varTest(), 74 VarType constants vbArray, 579 VbBoolean, 579 vbByte, 579 VbCurrency, 579 VbDataObject, 579 VbDate, 579 vbDecimal, 579 VbDouble, 579 VbEmpty, 579 VbError, 579 VbInteger, 579 VbLong, 579 VbNull, 579 VbObject, 579 VbSingle, 579 VbString, 579 VbVariant, 579 VarType() with arrays, using, 77 VarType(varAny) expression, 108 VB/COM function, 51 VB/COM object, 48 VBA code, 36 VBA features not in VBScript #Const, 625 Add, 625 CVDate, 625 Date, 625 DoEvents, 625 GoTo, 625 Option Base, 625 Type End Type, 625 VBA IDE, 36 VBA, features of, 36 vbBinaryCompare, 185 vbDatabaseCompare, 185 vbNewLine, 76 vbObjectError constant, 144, 591 VBScript features of, 37 limitations of, 135 overview of, 29 significance of, 37 VBScript (.vbs), 309 VBScript array, 69 VBScript as real programming language, 37 VBScript as subset of VB, 30 VBScript class, events of Class_Initialize, 210 Class_Terminate, 210 VBScript classes in script components, using, 385 VBScript classes, limitations of, 385 VBScript code, 250 VBScript compiler, 87 VBScript constants, built-in, 102 VBScript constants, Visual Basic supported color, 575 comparison, 575 date format, 576 miscellaneous constants, 577 MsgBox, 577 string constants, 578 tristate, 578 VarType, 579 VbGreen, 575 VBScript context arguments helpcontext, 144 helpfile, 144 VBScript data types, 43 VBScript Encoded Script files, 391 VBScript engine, 6, 10 VBScript Err object, 142 VBScript error codes, 581 VBScript error control, 135 VBScript error handling differences with Visual Basic's error handling, 592 in Internet Explorer, 594 On Error statement scope, 592 VBScript errors handling concept, 585, 592 runtime, 581 syntax, 583 VBScript features not in VBA Class, 623 Eval, 623 Execute, 623 RegExp, 623 ScriptEngine, 623 ScriptEngineBuildVersion, 623 ScriptEngineMajorVersion, 623 ScriptEngineMinorVersion, 623 VBScript for remote scripting, using, 408 VBScript Function procedure, 203 VBScript functions, 499 VBScript functions, built-in Len() function, 114 Mid() function, 114 Right() function, 114 VBScript hosts Internet Explorer, 150 Internet Information Services/ASP, 150 Windows Script Host, 150 VBScript keywords, 499 VBScript Len() function, 16 VBScript program, VBScript runtime engine, 129 VBScript runtime interpretation, 31 VBScript script engine, 3, VBScript scripting engine, 31 VBScript source code, 31 VBScript to applications, adding, 40 VBScript to VB applications, adding, 469 VBScript variable, different scopes of class-level scope, 90 procedure-level scope, 90 script-level scope, 90 VBScript variant subtypes Array, 629 Boolean, 628 Byte, 628 Currency, 628 Date, 628 Decimal, 628 Double, 628 Empty, 628 Error, 628 Integer, 628 Long, 628 Null, 628 Object, 628 Single, 628 String, 628 Variant, 628 VBScript version 5, 199 VBScripting tools, features of, 250 vbTextCompare, 185 VerifyFile function, 168 version information, 30 Version property Description, 290 Remarks, 290 Syntax, 290 View menu, 168 Visual Basic classes, 199 Visual Basic data types Boolean, 630 Byte, 629 Currency, 629 Date, 630 Decimal, 630 Double, 629 Integer, 629 Long, 629 Object, 630 String, 630 Variant, 630 Visual Basic for Applications (VBA), 35, 36, 253 Visual Basic, advantages of, 30 Visual Interdev debugger, 162 Visual Interdev, 162, 380 Team LiB Team LiB Index W W3C's DOM, 269 Web applications, 407 Web browsers Web browsers Internet Explorer, 35 Web browsers Netscape Navigator, 249 Web browsers Opera, 249 Web designer, Web model, 432 Web pages, 26, 33, 39 Web scripting CSS, 33 HTML, 33 JavaScript, 33 VBScript, 33 Web scripts, 26 Web server, 40 Web-Based Enterprise Management (WBEM), 308 Web-friendly files, 132 While statement, 118, 120 While…Wend loop, 124 While…Wend statement, 123 white space, matching, 246 window object property, 433 window object, 270 Window.Event property, 288 window.parent.frames(0), 273 window.parent.Lframe, 273 window_onload event, 259 Windows 9x/Me, 346 Windows administration tool, 308 Windows API, 36 Windows Event Log, 153 Windows Event Log LogEvent, 153 Windows Explorer, 155 Windows file system, 66, 137, 173 Windows GUI interface, 312 Windows Management Instrumentation (WMI), 308 Windows NT directory service, 308 Windows operating system, variables of COMSPEC, 325 HOMEDRIVE, 325 HOMEPATH, 325 NUMBER_OF_PROCESSORS, 325 OS, 325 PATH, 325 PATHEXT, 326 PROCESSOR_ARCHITECTURE, 325 PROCESSOR_IDENTIFIER, 325 PROCESSOR_LEVEL, 325 PROCESSOR_REVISION, 325 PROMPT, 326 SYSTEMDRIVE, 326 SYSTEMROOT, 326 TEMP, 326 TMP, 326 WINDIR, 326 Windows platforms, 307 Windows programming, 23 Windows registry, root keys for HKEY_CLASSES_ROOT, 336 HKEY_CURRENT_CONFIG, 336 HKEY_CURRENT_USER, 336 HKEY_LOCAL_MACHINE, 336 HKEY_USERS, 336 Windows Script Microsoft JScript, 29 Visual Basic Scripting Edition, 29 Windows Script Component (WSH), 38, 83 Windows Script Components overview of, 363 significance of, 363 Windows Script Engine 5.6, 30 Windows Script Host errors, 132 Windows Script Host Intrinsic Objects, 313 Windows Script Host objects WScript, 609 WshArguments, 609 WshController, 609 WshEnvironment, 609 WshNamed, 609 WshNetwork, 609 WshRemote, 609 WshRemoteError, 609 WshScriptExex, 610 WshShell, 610 WshShortcut, 610 WshSpecialFolders, 610 WshUnnamed, 610 WshUrlShortcut, 610 Windows Script Host, 1, Windows Script Interfaces (WSI), 469 Windows Script versions 1.0-Microsoft Internet Explorer 3.0, 30 2.0-Microsoft Internet Information Server 3.0, 30 3.0, 30 4.0-Microsoft Visual Studio 6.0, 30 5.0, 30 5.5-Microsoft Internet Explorer 5.5, 30 5.6-Microsoft Visual Studio NET, 30 Windows Script, supporting tools for, 29 debuggers, 29 script encoders, 29 WindowStyle property, 357 With block, 183 With keyword, 175 With…End With construct, 175 WithEvents keyword, 490 word processor program, 23 WordBuilder variable, 17 WorkingDirectory property, 358 Write method, 195, 196 WriteBlankLines method, 196 WriteFile procedure, 148 Wrox code download page, xxiv WScript object methods, 611 WScript object properties Arguments, 610 FullName, 610 Interactive, 610 Name, 610 Path, 610 WScript object, 314 WScript properties Arguments, 314 FullName, 314 Interactive, 315 Name, 315 Path, 315 ScriptFullName, 315 ScriptName, 315 StdErr, 315 StdIn, 315 StdOut, 315 Version, 315 WScript, methods of ConnectObject, 318 CreateObject, 318 DisconnectObject, 318 Echo, 318 GetObject, 318 Quit, 318 Sleep, 318 WScript.Arguments property, 322 WScript.Arguments.Unnamed instance, 343 WScript.Environment instance, 349 wscript.exe, 153, 155 WSH Engine, types of cscript.exe, 319 wscript.exe, 319 WSH files to launch scripts, using, 312 WSH for disk and network administration, using, 307 WSH object model, 307 WSH scripts, 38 WSH scripts, execution methods for, 307 WSH within Windows environment, execution of, 312 WSH, features of ability to run scripts remotely, 309 ability to use multiple languages, 309 access to the current working directory, 309 argument handling, 309 enhanced access to external objects and type libraries, 309 mechanism for pausing script execution, 309 new processes can be treated as objects, 309 new improved security model, 309 standard input/output and standard error report, 309 stronger debugging capability, 309 Support for drag-and-drop functionality, 309 support for file inclusion, 309 WshArguments object, 315, 322, 343 WshArguments object, accessing, 322 WshArguments() methods, 611 WshArguments, properties of, 322, 611 WshController object properties, 611 WshController() methods, 611 WshEnvironment object, accessing, 349 WshEnvironment() methods Count, 350 Remove, 350 WshEnvironment, properties of Item, 349 Length, 349 natIndex, 350 Object, 350 WshNamed methods Count, 342 Exists, 342 WshNamed object, 322, 341 accessing, 342 properties, 612 WshNamed, properties of Item, 342 Length, 342 WshNetwork methods, 613 WshNetwork object object, 319 strObject, 319 strPrefix, 319 WshNetwork object properties, 613 WshNetwork object, accessing, 344 WshNetwork, Methods of AddPrinterConnection, 345 AddWindowsPrinterConnection, 345 EnumNetworkDrives, 346 EnumPrinterConnection, 346 MapNetworkDrive, 346 RemoveNetworkDrive, 346 WshNetwork, properties of ComputerName, 344 UserDomain, 344 UserName, 344 WshRemote properties, 613 WshRemote() Methods, 613 WshRemoteError() methods, 614 WshScriptExec properties, 614 WshScriptExec() methods, 614 WshShell Object, accessing, 324 WshShell() methods, 359, 615 WshShell, methods of AppActivate, 328 CreateShortcut, 328 Exec, 328 ExpandEnvironmentStrings, 328 LogEvent, 328 Popup, 328 RegDelete, 328 RegRead, 328 RegWrite, 328 Run, 328 SendKeys, 328 WshShell, properties of CurrentDirectory, 324 Environment, 324 SpecialFolders, 324 WshShortcut object, 329, 353 WshShortcut properties Arguments, 354 Description, 354 FullName, 354 Hotkey, 354 IconLocation, 354 TargetPath, 354 WindowStyle, 354 WorkingDirectory, 354 WshShortcut() method, 358, 616 WshSpecialFolders methods, 617 WshSpecialFolders object methods, 353 properties, 352 WshSpecialFolders properties, 617 WshUnnamed object, 322, 343 WshUnnamed object, accessing, 343 WshUnnamed properties, 617 WshUnnamed() methods, 344, 617 WshUnnamed, properties of Item, 344 Length, 344 WshURLShortcut object, 329 WshUrlShortcut properties FullName, 359 TargetPath, 359 WshUrlShortcut() methods, 360, 618 WYSIWYG HTML editors, 250 WYSIWYG Web page design applications, 250 Team LiB Team LiB Index X XML framework, 365 Xor() function, 296 Team LiB Team LiB Index Y Yes button, 88 Team LiB Team LiB Index Z zero-length string, 21 Team LiB Team LiB List of Figures Chapter 1: A Quick Introduction to Programming Figure 1-1 Figure 1-2 Figure 1-3 Figure 1-4 Figure 1-5 Figure 1-6 Figure 1-7 Figure 1-8 Chapter 3: Data Types Figure 3-1 Figure 3-2 Figure 3-3 Figure 3-4 Figure 3-5 Figure 3-6 Figure 3-7 Figure 3-8 Figure 3-9 Figure 3-10 Figure 3-11 Figure 3-12 Figure 3-13 Figure 3-14 Figure 3-15 Figure 3-16 Chapter 4: Variables and Procedures Figure 4-1 Figure 4-2 Figure 4-3 Figure 4-4 Chapter 5: Control of Flow Figure 5-1 Figure 5-2 Figure 5-3 Figure 5-4 Figure 5-5 Figure 5-6 Figure 5-7 Chapter 6: Error Handling and Debugging Figure 6-1 Figure 6-2 Figure 6-3 Figure 6-4 Figure 6-5 Figure 6-6 Figure 6-7 Figure 6-8 Figure 6-9 Figure 6-10 Figure 6-11 Figure 6-12 Figure 6-13 Figure 6-14 Figure 6-15 Figure 6-16 Figure 6-17 Figure 6-18 Figure 6-19 Chapter 7: The Scripting Runtime Objects Figure 7-1 Figure 7-2 Chapter 8: Classes in VBScript (Writing Your Own COM Objects) Figure 8-1 Figure 8-2 Figure 8-3 Figure 8-4 Figure 8-5 Figure 8-6 Chapter 9: Regular Expressions Figure 9-1 Figure 9-2 Figure 9-3 Figure 9-4 Figure 9-5 Figure 9-6 Figure 9-7 Figure 9-8 Figure 9-9 Figure 9-10 Figure 9-11 Figure 9-12 Figure 9-13 Figure 9-14 Figure 9-15 Figure 9-16 Figure 9-17 Figure 9-18 Figure 9-19 Figure 9-20 Figure 9-21 Figure 9-22 Figure 9-23 Figure 9-24 Chapter 10: Client-Side Web Scripting Figure 10-1 Figure 10-2 Figure 10-3 Figure 10-4 Figure 10-5 Figure 10-6 Figure 10-7 Figure 10-8 Figure 10-9 Figure 10-10 Figure 10-11 Chapter 11: Super-Charged Client-Side Scripting Figure 11-1 Figure 11-2 Figure 11-3 Figure 11-4 Figure 11-5 Figure 11-6 Figure 11-7 Figure 11-8 Chapter 12: Windows Script Host Figure 12-1 Figure 12-2 Figure 12-3 Figure 12-4 Figure 12-5 Figure 12-6 Figure 12-7 Figure 12-8 Figure 12-9 Figure 12-10 Figure 12-11 Chapter 13: Windows Script Components Figure 13-1 Figure 13-2 Figure 13-3 Figure 13-4 Figure 13-5 Figure 3-6 Figure 13-7 Figure 13-8 Figure 13-9 Figure 3-10 Figure 10-11 Figure 13-12 Figure 13-13 Chapter 14: Script Encoding Figure 14-1 Figure 14-2 Figure 14-3 Figure 14-4 Chapter 16: HTML Applications Figure 16-1: From www.wrox.com Copyright © 2004 by Wiley Publishing, Inc All rights reserved Reproduced here by permission Figure 16-2: From www.wrox.com Copyright© 2004 by Wiley Publishing, Inc All rights reserved Reproduced here by permission Figure 16-3: From www.wrox.com Copyright © 2004 by Wiley Publishing, Inc All rights reserved Reproduced here by permission Figure 16-4: From www.wrox.com Copyright © 2004 by Wiley Publishing, Inc All rights reserved Reproduced here by permission Figure 16-5: From www.wrox.com Copyright © 2004 by Wiley Publishing, Inc All rights reserved Reproduced here by permission Figure 16-6: From www.wrox.com Copyright © 2004 by Wiley Publishing, Inc All rights reserved Reproduced here by permission Figure 16-7 Figure 16-8 Figure 16-9 Chapter 17: Server-Side Web Scripting Figure 17-1 Figure 17-2 Figure 17-3 Figure 17-4 Figure 17-5 Chapter 18: Adding VBScript to Your VB Applications Figure 18-1 Figure 18-2 Team LiB ... professionals Team LiB Team LiB VBScript Programmer's Reference, Second Edition Adrian Kingsley-Hughes Kathie Kingsley-Hughes Daniel Read VBScript Programmer's Reference, Second Edition Published by Wiley... technology has also matured over time and gained in both effectiveness and popularity VBScript Programmer's Reference, 2nd Edition begins with discussion of the general syntax, functions, keywords, style,... Book Covers As you'd expect, a book on VBScript covers VBScript To be precise, this book covers VBScript right up to the latest version (version 5.6) However, VBScript is a tool that can be used