O'Reilly logo

Windows Me Annoyances by David A. Karp

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Wacky Script Ideas

The point of scripting is that instead of using a canned application to perform a certain task, you can easily and quickly throw together a script that does exactly what you need. That said, you may need some inspiration to get you cooking.

The following examples use many of the custom subroutines outlined earlier in this book, but for brevity and sanity, they won’t be repeated.

Quick Floppy Backup Tool

The script in Example 9-4 starts by prompting you for the name of a folder to back up and checks to see if it exists. If not, it gives you an opportunity either to type another folder name or exit. Once a valid folder name has been entered, the script creates a backup of the entire folder on your floppy drive.

Example 9-4. Quick Floppy Backup Tool

On Error Resume Next Accepted = False Do Until Accepted MyFolder = InputBox("Please enter the name of the folder _ you want to back up.") If Not FolderExists(MyFolder) Then Answer = MsgBox("The folder you typed doesn't exist. _ Try again?", 36, "") If Answer = 7 Then WScript.Quit Else Accepted = True End If Loop Answer = MsgBox("Please put a diskette in your floppy drive.", 33, "") If FolderSize(MyFolder) > DriveFreeSpace("a") Then MsgBox "The folder you specified won't fit on the floppy.", 16 WScript.Quit End If If FolderCreate("a:\Backup\") = False Then MsgBox "There was a problem writing to the diskette.", 16 WScript.Quit End If Call FolderCopy(MyFolder, "a:\Backup\") If Right(MyFolder, 1) <> "\" Then MyFolder = MyFolder ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required