Appendix C Whats on the CD-ROM?

Appendix C What s on the CD ROM?

The best way to become a good script developer is to spend time writing new scripts. However, it helps to have a collection of scripts from which you can cut and paste when starting out. Hopefully, you've been creating the scripts that you've seen in this book as you've gone along. But just in case you missed some, I've added copies of each script to the book's CD-ROM. In this appendix, I'll provide a brief reference to each of the scripts that you'll find on the CD-ROM.

The book's CD-ROM also contains copies of three editors that you may want to try. I'll provide a high-level overview of each editor and tell you where you can go for more information.

Script Examples

Table C.1 provides a quick overview of all the sample scripts from this book that are located on the accompanying CD-ROM.

Table C.1: SAMPLE SCRIPTS LOCATED ON THE CD-ROM

Reference

Script

Description

Chapter 1

Greeting.vbs

Collects the user's name and displays a greeting message

Hello-1.vbs

Displays the classic "Hello World!" message

Hello-2.vbs

Displays a message using the WshShell object's Popup() method

Hello-3.vbs

Displays a message using the WScript object's Echo() method

KnockKnock.vbs

A "Knock Knock" joke game

Chapter 2

EventLogger.vbs

Demonstrates how to write messages to the Windows application event log

Greeting.vbs

Another example of how to use the WScript object's Echo() method

Messenger.vbs

Demonstrates how to use VBScript and the WSH as a wrapper for the Windows NET SEND command

NetInfo.vbs

Demonstrates how to collect network information

RockPaperScissors.vbs

A "Rock, Paper and Scissors" game

Chapter 3

FreeSpace.vbs

Demonstrates how to determine how much free space is left on a disk drive

MathGame.vbs

Prompts the user to solve a mathematical equation and demonstrates how to solve it in the event that the user cannot do so

SquareRootCalc - 1.vbs

Demonstrates how to solve square root calculations using a mathematic solution devised by Sir Issac Newton

SquareRootCalc - 2.vbs

Demonstrates how to solve square root calculations using VBScript's built-in Sqr() function

Chapter 4

ArgumentProcessor.vbs

Demonstrates how to work with arguments passed to the script by the user at execution time

ArrayDemo.vbs

Demonstrates how to store and retrieve data using a single-dimension VBScript array

BigBadWolf.vbs

Demonstrates how to use the Option Explicit statment

CaptainAdventure.vbs

Prompts the user to answer a number of questions and then uses the answers to create a comical action adventure story.

ComputerAnalyzer.vbs

Demonstrates how to access environment variables using the WSH

HappyHour.vbs

Tells the user if it's Friday

LittlePigs.vbs

Demonstrates how to use a constant to create a standardized titlebar message for popup dialogs displayed by the script

MathDemo.vbs

Demonstrates how to use various VBScript arithmetic operators

MsgFormatter.vbs

Demonstrates how to use VBScript string constants to control how text messages are displayed

ResizeArray.vbs

Demonstrates how to resize an array during execution

Chapter 5

RockPaperScissors - 2.vbs

Revisits the RockPaperScissors.vbs script first introduced in Chapter 2 and updates it using advanced conditional logic

RockPaperScissors - 3.vbs

Revisits the RockPaperScissors-2.vbs script, replacing some of the If statment logic with a Select Case statement

StarTrekQuiz.vbs

Creates a Star Trek Quiz game

Chapter 6

GuessANumber.vbs

Plays a number-guessing game with the user

ShortcutMaker.vbs

Creates shortcuts on the Windows desktop, Programs menu, and Quick Launch Toolbar for the GuessANumber.vbs VBScript

Chapter 7

BlackJack.vbs

Creates a scaled-down version of casino Blackjack

GuessANumber - 2.vbs

Plays a number-guessing game with the user

Chapter 8

Hangman.vbs

Demonstrates how to create a game of Hangman using VBScript and the WSH

Chapter 9

Hangman - 2.vbs

Completes the Chapter 8 Hangman game by configuring it to store and retrieve game settings using the Windows registry

Chapter 10

GameConsole.vbs

Creates a game console that builds a dynamic list of VBScript games for the player to select from

Appendix A

ScreenSaver.vbs

Changes the user's screen saver settings

BackGround.vbs

Changes the user's background selection to "None" and sets the default background color to white

DriveMapper.vbs

Demonstrates how to add logic to VBScripts in order to set up a network drive mapping

MapBuster.vbs

Demonstrates how to add logic to VBScripts in order to terminate a network drive mapping

PrinterMapper.vbs

Demonstrates how to use a VBScript to set up a connection to a network printer

PrinterBuster.vbs

Demonstrates how to use a VBScript to disconnect a network printer connection

ServiceCycler.vbs

Demonstrates how to use VBScript to stop and start Windows services

AccountCreator.vbs

Demonstrates how to use VBScript to create new user accounts

AtScheduler.vbs

Demonstrates how to use the Windows AT command within a VBScript to schedule the execution of other scripts

VBScript Editors

You'll also find three good script editors located on the book's accompanying CD-ROM. Unless you already have a script editor that you really like, I recommend that you take a look at each of these editors.

Unlike simple text editors such as Windows NotePad, these editors provide a number of advanced features that you'll soon find essential when writing your own scripts. For example, keyword color-coding should be considered an essential requirement for any good editor. Color-coding highlights different components in your scripts by displaying text using different colors. For example, comments may appear in green, while other VBScript keywords appear in blue, and your variables, objects, and constants appear in black.

Another important feature to look for is line numbering, or identification. VBScript error messages provide the line number of the statement on which an error occurs. Therefore, a VBScript editor helps you to zoom right in on the source of the error.

Another convenient feature of editors is the ability to save and execute your VBScripts from within the editor. This saves you a lot of time and effort because you no longer have to jump from the editor to either the Windows desktop or Command Console every time you need to test your script.

Adersoft VbsEdit

Adersoft VbsEdit, shown in Figure C.1, is a script editor designed specifically for the development of VBScript. It is distributed as shareware with a limited period of free trial use. At the time of this writing, a licensed version of Adersoft VbsEdit can be downloaded and purchased for just $15.

Figure C.1: The Adersoft VbsEdit VBScript editor

Major features provided by this VBScript editor include:

To learn more about Adersoft VbsEdit, or to purchase a licensed copy, visit http://www.adersoft.com/vbsedit.

VBSEditor

Another good VBScript editor is the Koala VBSEditor, shown in Figure C.2. This script editor is designed specifically to support VBScript development. Best of all, as of the writing of this book VBSEditor is freeware, which means that you don't have to purchase it to use it.

Figure C.2: The Koala VBScript editor

Major features provided by this VBScript editor include:

To learn more about the VBSEditor, visit http://www.koansoftware.com/Eng/script.htm.

SitePad Pro

The third editor that you find on this book's accompanying CD-ROM is Model-Works SitePad Pro, shown in Figure C.3. SitePad Pro is distributed as shareware, which means you can try it free for a limited period of time before purchasing a licensed copy. This editor provides advanced support for a number of programming languages, including Java, HTML, VRML, JavaScript, and VBScript. Its support for VBScript includes the following features:

Figure C.3: The ModelWorks SitePad Pro editor

To learn more about ModelWorks SitePad Pro, or to purchase a licensed copy, visit http://www.modelworks.com/products.html.

Категории