did-you-know? rent-now

Amazon no longer offers textbook rentals. We do!

did-you-know? rent-now

Amazon no longer offers textbook rentals. We do!

We're the #1 textbook rental company. Let us show you why.

9780130287014

Windows Script Host

by
  • ISBN13:

    9780130287014

  • ISBN10:

    0130287016

  • Edition: 1st
  • Format: Paperback
  • Copyright: 2001-01-01
  • Publisher: Prentice Hall
  • Purchase Benefits
  • Free Shipping Icon Free Shipping On Orders Over $35!
    Your order must be $35 or more to qualify for free economy shipping. Bulk sales, PO's, Marketplace items, eBooks and apparel do not qualify for this offer.
  • eCampus.com Logo Get Rewarded for Ordering Your Textbooks! Enroll Now
List Price: $44.99

Summary

Windows Script Host (WSH) gives anyone, from intermediate users to experienced systems administrators, the ability to save time and reduce errors by automating many system, application, and file-related tasks in Windows 9x, Windows ME, and Windows 2000. In this book, expert developer and best-selling author Peter G. Aitken offers in-depth coverage of Windows scripting with both VBScript and JScript. Master the Windows file system and scripting object models; learn the most effective ways to run, schedule, and distribute scripts; and discover practical techniques for scripting virtually every aspect of the Windows environment. For all intermediate to advanced-level Windows users, including both administrators and power users.

Table of Contents

Introduction xix
Who This Book Is For xix
What You Need xx
Resources xx
Windows Script Host Fundamentals
1(10)
Background
1(2)
Unix Scripting
2(1)
The DOS Batch Language
2(1)
Windows Scripting
3(1)
How WSH Works
3(2)
What Can WSH Do?
3(1)
WSH Operation
4(1)
Scripting Technology
5(4)
Two Scripting Utilities
6(3)
WSH Languages
9(1)
WSH and Objects
10(1)
Overview
10(1)
The WSH Object Model
11(45)
Objects
11
Object References
12(1)
Object Properties
13(4)
Object Method
S14
Collections
17(1)
The WshCollection Object
17(1)
The FileSystemObject
18(1)
The Dictionary Object
19(3)
The Wscript Object
22(8)
Obtaining Host Information
24(1)
Script Interactivity
25(1)
Terminating a Script
26(1)
Setting a Timeout
26(1)
Working with Objects
27(3)
The WshShell Object
30(19)
The WshEnvironment Object
31(1)
The WshSpecialFolders Object
32(3)
Working with Shortcuts
35(4)
Displaying Popup Messages
39(3)
Working with the Registry
42(4)
Running Programs
46(3)
The WshNetwork Object
49(6)
Obtaining User Information
49(2)
Working with Printers
51(2)
Managing Network Drives
53(2)
Overview
55(1)
Creating, Running, and Scheduling Scripts
56(9)
Creating Your Scripts
56(1)
Online Documentation
57(1)
Running Scripts
58(6)
Script Shortcuts
59(1)
Scheduling Scripts
60(4)
Overview
64(1)
Working with Script Arguments, .WSH Files, and Web Scripting
65(18)
Script Arguments
65(3)
WSH Files
68(2)
WSH and Web Scripting
70(1)
Overview
71(1)
Testing and Debugging Your Script
s72
Catching Script Errors
72(4)
Syntax Errors
72(2)
Run-Time Errors
74(1)
Bugs
75(1)
Debugging Your Scripts
76(6)
The Script Debugger
76(1)
Using the Debugger
77(5)
Overview
82(1)
VBScript: Syntax, Data Storage, and Operators
83(17)
Introduction to VBScript
83(1)
Comparison with Visual Basic
84(1)
Syntax Fundamentals
84(1)
Comments
85(1)
Line Continuations
85(4)
Data Storage
86(3)
Object References
89(1)
Determining Data Type
89(1)
Arrays
90(4)
Static Arrays
90(2)
Dynamic Arrays
92(2)
Variant Arrays
94(1)
Operators
94(4)
Assignment Operator
94(1)
Arithmetic Operators
95(1)
String Operators
95(1)
Comparison Operators
96(1)
Logical Operators
97(1)
Operator Precedence and Parentheses
98(1)
Overview
99(1)
VBScript: Program Control and Procedures
100(15)
Conditional Statements
100(4)
If...Then...Else
101(1)
Select Case
102(2)
Loop Statements
104(5)
For...Next
104(1)
For Each...Next
105(1)
Do...Loop
106(2)
While...Wend
108(1)
Infinite Loops
108(1)
Procedures
109(5)
Types of Procedures
109(1)
Defining a Procedures
110(1)
Passing Arguments to Procedures
110(2)
Variables in Procedures
112(1)
Calling Procedures
113(1)
Overview
114(1)
VBScript: Working with Text, Numbers, Dates, and Times
115(20)
Text Manipulation
115(12)
Asc
116(1)
Chr
116(1)
Filter
117(2)
InStr, InStrRev
119(1)
InStrRev
119(1)
Join
119(1)
LCase, UCase
120(1)
Left, Mid, Right
120(1)
Len
121(1)
LTrim, RTrim, Trim
121(1)
Mid (function)
121(1)
RegExp
121(5)
Right
126(1)
RTrim
126(1)
Space
126(1)
Split
126(1)
String
126(1)
StrComp
127(1)
Trim
127(1)
UCase
127(1)
Working With Numbers
127(1)
Using Dates and Times
128(6)
Date and Time Representation
129(1)
Getting the Current Date and Time
129(1)
Creating Dates and Times
129(1)
Adding and Subtracting Dates and Times
130(1)
Getting Date and Time Information
131(2)
Formatting Dates and Times
133(1)
Overview
134(1)
VBScript: User Interaction, Error Handling, And Miscellaneous Topics
135(8)
Interacting with the User
135(3)
The MsgBox Function
135(2)
InputBox
137(1)
Error Handling
138(2)
Other Topics
140(2)
Eval
141(1)
Execute and ExecuteGlobal
141(1)
Overview
142(1)
JScript: Basic Syntax, Data Storage, and Operators
143(14)
Introduction to JScript
143(2)
Comparison with Java
144(1)
Syntax Fundamentals
144(1)
Comments
145(1)
Data Storage
145(6)
Constants
145(2)
Variables
147(1)
Data Types and Coersion
148(1)
Object References
149(1)
Arrays
150(1)
JScript Operators
151(5)
The Assignment Operators
151(1)
The Arithmetic Operators
152(1)
The Increment and Decrement Operators
152(1)
The Comparison Operators
153(1)
The Logical Operators
154(1)
String Operators
155(1)
Conditional Expressions
155(1)
Operator Precedence and Parentheses
156(1)
Overview
156(1)
JScript: Conditional Statements, Loops, and Functions
157(12)
Conditional Statements
157(4)
If...Else
157(3)
Switch
160(1)
Loop Statements
161(3)
For
161(1)
While
162(1)
Do...While
163(1)
The Continue Statement
163(1)
The With Statement
164(1)
Functions
164(4)
Defining a Function
165(1)
Variables in Functions
166(1)
Calling a Function
167(1)
OverView
168(1)
JScript: Strings, Numbers, Math, Dates, and Times
169(12)
The String Object
169(5)
The Split Method
172(1)
Working with Regular Expressions
172(2)
The Number Object
174(2)
The Math Object
176(1)
Dates and Times
176(4)
Overview
180(1)
JScript: Built-in Objects, User Interaction, and Error Handling
181(11)
JScript Objects
181(5)
The Boolean Object
182(1)
The Enumerator Object
182(1)
The Function Object
183(1)
The VBArray Object
184(2)
User Interaction
186(2)
Error Handling
188(3)
The Error Object
188(1)
Try.. . C
188(2)
The Throw Statement
190(1)
Overview
191(1)
WSH 2.0 and WSF Files
192(8)
Using WSF Files
192(1)
XML and WSF Files
193(4)
The <script> Tag
193(1)
The <job> and <package> Tags
194(1)
The <object> Tag
195(1)
The <reference> Tag
195(1)
Importing Files
196(1)
XML Compliance
197(1)
XML Errors and Debugging
198(1)
Overview
199(1)
File Access and Management
200(24)
The Scripting Run-time Library
200(2)
File Management
202(16)
Copying and Moving Files
202(2)
Copying and Moving Folders
204(1)
Creating Folders
205(1)
Deleting Files and Folders
205(1)
Seeing if a Drive, Folder, or File Exists
205(1)
Obtaining Object References
206(1)
Working with the Drives Collection and Drive Object
206(3)
Working with the Folders Collection and Folder Object
209(4)
Working with the Files Collection and File Object
213(4)
Other FileSystemObject Methods
217(1)
File Access
218(5)
The TextStream Object
218(3)
A TextStream Demonstration
221(2)
Overview
223(1)
Creating Windows Script Components
224(12)
Defining a Class
224(8)
Creating Class Instances
225(1)
Defining Class Properties
225(1)
Defining Class Methods
226(2)
Defining Private Class Information
228(1)
Procedural Class Properties
228(3)
Defining a Default Class Property
231(1)
Using a Class in Multiple Scripts
232(1)
A Class Example
233(2)
Overview
235(1)
Database Access with Scripting
236(23)
Database Fundamentals
236(3)
Database Technologies
239(1)
Active Data Objects
240(1)
Creating a Connection
241(6)
Creating a Connection String
243(2)
Recordsets
245(2)
Creating a Recordset
247(4)
Working with Recordsets
251(7)
Accessing Field Data
251(1)
Moving through a Recordset
252(3)
Modifying Recordset Data
255(3)
Overview
258(1)
Scripting Microsoft Office Components
259(27)
The Office Object Model
259(2)
The Word Object Model
261(10)
The Document Object
261(2)
Manipulating Document Content
263(7)
Other Document Properties and Methods
270(1)
The Excel Object Model
271(14)
The Workbook Object
272(2)
The Worksheet Object
274(11)
Validating Object References
285(1)
Overview
285(1)
Messaging With WSH
286(21)
Scripts and Messaging
286(2)
Some E-mail Background
288(1)
Scripting CDO
289(5)
Sending a Message with CDO
289(3)
Reading Mail with CDO
292(2)
Scripting Microsoft Outlook
294(12)
The NameSpace Object
295(1)
Manipulating Folders and Items
295(2)
Working with Mail Messages
297(9)
Overview
306(1)
Using WSH For Administrative Tasks
307(12)
Mapping Network Drive
s307
Automating LogOn Scripts
310
Updating File
s312
Creating Folders
315(3)
Overview
318(1)
A Script Programmer's Library
319(13)
Installing Files from a CD
319(5)
Obtaining Information about a Database
324(5)
Printing from a Script
329(3)
Appendix A VBScript Constants 332(4)
Color Constant
S332
Comparison Constants
332(1)
Date and Time Constants
333(1)
Date and Time Format Constants
333(1)
Miscellaneous Constants
334(1)
MsgBox Constants
334(1)
String Constants
335(1)
Appendix B VBScript Keywords 336(2)
Appendix C ASCII Character Codes 338(3)
Appendix D VBScript Error Codes 341(2)
Appendix E JScript Reserved Words 343(2)
Current Reserved Words
343(1)
Future Reserved Words
343(1)
Words to Avoid
344(1)
Appendix F JScript Error Codes 345(2)
Appendix G WSH Resources on the Internet 347(2)
Index 349

Supplemental Materials

What is included with this book?

The New copy of this book will include any supplemental materials advertised. Please check the title of the book to determine if it should include any access cards, study guides, lab manuals, CDs, etc.

The Used, Rental and eBook copies of this book are not guaranteed to include any supplemental materials. Typically, only the book itself is included. This is true even if the title states it includes any access cards, study guides, lab manuals, CDs, etc.

Excerpts

IntroductionThe Windows Script Host, or WSH, is a wonderful tool that is available to all users of the Windows operating system. In a nutshell, WSH is used to create scripts that automate operating system-related tasks. Which tasks are these? Anything you do with the Windows operating system, as opposed to an application program, falls into this category. Examples include copying and deleting files, logging onto network drives and printers, and executing programs. But WSH is not limited to operating system tasks - thanks to Microsoft's Component Object Model, scripts can also control many applications programs, such as Word and Excel. Almost anything you can do sitting at your computer's keyboard, you can also program a script to do for you.So, what's the big deal? There are two factors: Saving time. With a couple of clicks, you can execute a script that carries out a complex series of action that would take a considerable time to perform manually. Preventing errors. Once tested and debugged, a script will carry out a precise sequence of actions error-free every time. Few people can say the same thing about their keyboard skills!Either of these factors by itself would make a strong argument for scripting. Together, they are overpowering. Any Windows user who has gone beyond casual computing is a candidate to benefit from using WSH. Network administrators and other computer professionals can derive even more benefit. Who This Book Is ForThe intended audience for this book is anyone who wants to automate repetitive or time-consuming tasks under the Windows operating system. This includes both computer users, for whom the computer is a tool, as well as network professionals and systems administrators, who are responsibile for maintaining computer systems used by others. I assume no prior knowledge on the part of the reader beyond a reasonable familiarity with Windows. Specifically, no programming experience is needed. If, however, you do have some programming experience, certain parts of the book will likely go faster for you. What You NeedThe requirements for using this book are quite simple: a computer running Windows 95, 98, ME, NT 4.0, or 2000. As you will learn in Chapter 1, WSH is installed along with some of these operating systems, but must be installed separately with others (Windows 95 and NT). Details on obtaining the free install are also included in Chapter 1. ResourcesYou will find my Web page for this book at this URL: http://www.pgacon.com/scripthost.htmThis page lets you download a compressed archive containing all of the book's scripts, and there is also a link for reporting any errors, problems, or suggestion. I will also post a list of corrections and updates as they become available. Additional Internet resources for the Windows Script Host programmer can be found in Appendix 7. Peter G. Aitken Chapel Hill, North Carolina January 2001

Rewards Program