Windows XP Annoyances Free Open Book

Windows XP Annoyances

Previous PageNext Page

Chapter 9. Scripting and Automation

One of the ways to improve your experience with Windows XP is to reduce the time it takes to perform repetitive tasks, whether that involves backing up important files once a week, or generating custom web pages once every three seconds. Scripting, a form of very simple programming, is well suited to quick-and-dirty tasks, such as simple file operations, managing network connections, and even starting several programs with a single click of a button.

Scripts are plain-text files that can be written and executed without a special development environment and don't require a compiler—just use your favorite text editor, or Notepad and don't require a compiler. (Simply put, a compiler is a program that translates editable program source code into application executables, such as .exe and .dll files. Scripts interpreted rather than compiled, which means that another program reads and executes the commands in the script, line-by-line.)

Windows comes with two forms of scripting: the Windows Script Host (WSH) and batch files. Both technologies have their strengths and limitations. Batch files are somewhat simpler to write, but WSH scripts are much more flexible and powerful and offer better user interaction. WSH scripts are Windows-based, and can take advantage of Windows' services, such as printing, networking, and Registry access. DOS batch files can be run on any PC made after 1982, regardless of the version of Windows being used, but WSH scripts run only on Windows 98/Me, Windows 2000, and Windows XP. (Windows 95 and Windows NT 4.0 can also run WSH scripts, but only after installing Microsoft's freely-available WSH add-on.)

The Windows Script Host is the engine behind the execution of scripts. Rather than a tangible, interactive application like Notepad or Internet Explorer, WSH is simply an extensible collection of support files. The beauty of the Windows Script Host (yes, I said beauty in regards to a Microsoft product) is that it is language-independent, meaning that it will work with any modern scripting language. It has built-in support for JavaScript and VBScript, but can be extended (with third-party add-ons) to use almost any other language, such as Perl and Python. This extensibility is a welcome change from Microsoft's usual narrow support of only its own, proprietary technologies.

VBScript is based on another Microsoft programming language, Visual Basic (VB), which, in turn, is loosely based on Beginner's All-purpose Symbolic Instruction Code (BASIC). If you're at all familiar with BASIC, taught in grade school since the seventies, the basics of VBScript won't be much of a challenge. VBScript will be used primarily in this chapter because it's easy to learn, it supports easy access to the features we need, like Registry access and file operations, and its cousin, VB, is one of the most widely used programming environments in the world.

So where does the Windows Script Host end and the VBScript language begin? From the point of view of the end user, WSH is started when you double-click on a script file, at which point it automatically chooses an appropriate language interpreter based upon the script filename extension. From the point of view of the developer, WSH provides special functionality to all languages through the use of objects (see Section 9.1.6 later in this chapter); that way, each WSH-supported language needn't bother including functionality for advanced functions, such as Registry access and filesystem operations.

The primary goals of this chapter are to provide an orientation to using the Windows Script Host and to show useful problem-solving applications that illustrate the power and flexibility of WSH.

Previous PageNext Page


     Main Menu
Cover
Copyright
Preface
Chapter 1. Making the Most of Windows XP
Chapter 2. Basic Explorer Coping Skills
Chapter 3. The Registry
Chapter 4. Tinkering Techniques
Chapter 5. Maximizing Performance
Chapter 6. Troubleshooting
Chapter 7. Networking and Internetworking
Chapter 8. User Accounts and Administration
Chapter 9. Scripting and Automation
9.1 Building a Script with VBScript
9.2 Running Applications from Scripts
9.3 Accessing the Registry from Scripts
9.4 Manipulating Files from Scripts
9.5 Creating Windows Shortcuts and Internet Shortcuts in Scripts
9.6 Networking with Scripts
9.7 Manipulating Internet Explorer from Scripts
9.8 Using Command-Line Parameters in Scripts
9.9 Managing Services with Scripts
9.10 Writing CGI Scripts for a Web Server
9.11 Making a Startup Script
9.12 Deciphering Script Errors
9.13 Finding a Better Editor
9.14 Further Study
9.15 Automating Scripts with Scheduled Tasks
9.16 Wacky Script Ideas
Chapter 10. Installing Windows XP
Appendix A. Setting Locator
Appendix B. BIOS Settings
Appendix C. Command Prompt Crash Course
Appendix D. TCP/IP Ports
Appendix E. Error Messages (Blue Screen of Death)
Colophon


More Books
PHP Hacks
Processing Xml With Java - A Guide To Sax, Dom, Jdom, Jaxp, And Trax
The Koran (Holy Qur'an)
Macromedia Flash 8 Bible
Search Engine Optimization for Dummies
YouTube Traffic
PHP 5 for Dummies
Harry Potter and The Chamber of Secrets
Harry Potter and the Sorcerer's Stone
The Pilgrim's Progress
Wireless Hacks
Flash Hacks. 100 Industrial-Strength Tips & Tools
PayPal Hacks. 100 Industrial-Strength Tips and Tools
Amazon Hacks
Pdf Hacks
The Da Vinci Code
Google Hacks
The Holy Bible
Windows XP For Dummies
Harry Potter and the Half-Blood Prince
Seo Book
Upgrading and Repairing Networks
Macromedia Dreamweaver 8 UNLEASHED
Windows XP Annoyances
Windows XP Hacks
Microsoft Windows XP Power Toolkit
Teach Yourself MS Office In 24Hours
iPod & iTunes Missing Manual
PC Hacks 100 Industrial-Strength Tips and Tools
PC Overclocking, Optimization, and Tuning - 2th Edition
PC Hardware In A Nutshell 3rd Edition
PC Hardware in a Nutshell, 2nd Edition
Upgrading and Repairing PCs
Google for Dummies
MySQL Cookbook
Teach Yourself Macromedia Flash 8 In 24 Hours
PHP CookBook
Sams Teach Yourself JavaScript in 24 Hours
PHP5 Manual
Free Games Paper Airplanes
500 Juegos Gratis 500 Giochi Gratis 500 Jeux Gratuits 500 Jogos Gratis 500 Kostenlose Spiele