I wrote all this code (except for what I didn't write!) to solve my problems. That means it isn't bug-free. The code did what I wanted and I stopped development there. At least it will give you a starting point.

File Utilities

Number File

In order to get my photos to sort right for slide shows, I add numbers (and a dash) to the beginning of the file names. That's a hassle to do manually, so this script was created. Just drop your files one-at-a-time on this script and it will stick progressively higher numbers on the beginning of the file names. The numbers go up 10 at a time to allow you to make a few last-minute changes without having to renumber the whole collection.

Date Name

Do you have a process that kicks out an identically-named file every day? If you want to rename them so they don't overwrite each other, naming them with date seems the most natural solution. You pass it a file name like this:
cscript.exe DateName.vbs C:\PROGRA~1\FNORDW~1\LOGS\REFERE~1.TXT

or a quoted long name like this:
cscript.exe DateName.vbs "C:\Program Files\Fnord Web Server\logs\Reference Log.txt"

And it would rename the corresponding
"C:\Program Files\Fnord Web Server\logs\Reference Log.txt"

to
"C:\Program Files\Fnord Web Server\logs\1999-12-28-Reference Log.txt"

I used year-month-date to make sorting easier.

Time Date Name

Same as the above DateName, but this one adds time as well. Prefaces the file name with year-month-date-hour-minute-second

DirList

Written by Fred Coleman. Fred actually got this one written up in the German PC Magazine! This willl create an "index.htm" file for any given directory. Two weeks after I decided nobody would ever need to index a directory, I found myself needing to do it dozens of times. So I got Fred's code posted so YOU won't have to build your solution from scratch!

Index

Similar in concept to Fred's script above, except I wanted mine to display icons. Amazingly, I found a way to do it. Brute force and obscure graphics formats to the rescue! For a real-life sample, most of the links on this page take you to (very simple) index pages made by this script.

Sync Dirs

If you have two different folder "trees" you need to synchronize (or update), this might help. In my case, I had a "tree" that was a single folder full of utility programs. I had another tree that had those same utilities arranged in folders sorted by category. Trouble is, when I update them, I always put the updates in the flat single-folder tree. The category tree never got updated. That's where this script comes in! It looks at every file in every folder in the destination tree (my utilities organized by category), then searches for the matching file in the source tree (my single folder of unsorted files). If it finds a match, it checks file modification dates. If a newer version is available in the source tree, it copies it to the destination tree. Note that the source and destination trees do NOT have to have the same structure. An effect of unstructured tolerance is that only existing files in the destination are processed. If the source tree has extra files in it, they won't be copied over to the destination tree because the script has no idea where they would go in the destination tree!

Folder File Properties

Uses the Shell.Application/Namespace/GetDetailsOf function to retrieve all the file details you'd normally get by right-clicking a file. In addition to the normal file attributes exposed by the Scripting.FileSystemObject, using Shell.Application also gets you data like the file version, description, manufacturer, owner, title, audio format, and sender name. Obviously not all properties apply to all files. This script generates a CSV report showing all the details for every file in a folder. Just drop a folder on the script. Or just steal this code as a reference when you need to do something like show all files owned by "Administrator".

Spaces To Tabs

I used to write all my scripts with spaces for indenting because it looked better under Notepad. Unfortunately, it also made it harder to edit under Notepad! So I changed all my scripts to use tabs instead of spaces. And I used this script to do it. Put it in the starting folder and run it. It will verify what file extensions you want to modify, and convert all instances of four spaces to a single tab character. Simple, actually.

Hosts

If you're the sort of person who uses (or misuses) the HOSTS file to block advertising and badware, you may have been frustrated by how difficult it is to update, sort, and organize a large HOSTS file. This is a set of scripts that make it possible to do those things with almost no effort. The scripts aren't fast, but I'm rarely in a hurry.

Functions

This will search all your source code and document the functions and subroutines it finds. As written, it searches VBS and ASP files, but this is easily modified via a constant. It searches for lines beginning with "Function " or "Sub ", and again, this is easily modified via a constant. The script starts running in the directory where it is located and produces a tab-delimited report named after the script file (like "Functions.txt").

Trim Log Files

I have lots of log files that do nothing but grow. So I wrote this to trim them down to a reasonable size. I run it as a scheduled task every night. The log files must have entries on separate lines. This script keeps the most recent entries at the end of the log and throws away old entries at the beginning of the log. Pass it a file name and a desired max size (between a hundred bytes and a million bytes). Use it like this:
cscript.exe TrimLogFiles.vbs "c:\logs\server.log" 32767

Delete Old Files

Let it loose on the network "share" drive every once in a while. It deletes files in and below any directory you select based on age. Designated file extensions can be protected from deletion.

No Old Files

Similar to the above script based on common requests from system administrators. It can take both arguments from the environment, the command line, or interactively from the user. It deletes designated file extensions. By popular request, the script now deletes empty subdirectories. However, because this is a top-down, list-driven script, it only deletes the lowest-level empty directory in each branch of the directory tree on each run. If you run it on a regular schedule, it will eventually get around to deleting all empty unused subdirectories. Use it like this:
cscript.exe NoOldFiles.vbs "S:\Share" 90

No Old Folders

This one only deletes old folders (as defined by the folder's "last modified" date). Of course, if it deletes an old folder, it will delete all other files and subfolders under it regardless of the age of those files or subfolders! This script only takes arguments from the command line. Give it a starting folder (which will not be deleted!) and the maximum age of a folder (in days) you wish to keep. This script is recursive, not list-driven... which doesn't actually matter in this particular case.

No Small Files

If it's little, who is going to notice it's missing? Or even better, if it's little, it must have been a bad download, so it it should be deleted.

No Brackets

If you've ever dragged files out of your IE temporary internet files folder (the easiest way to investigate linked style sheets and scripts or get copies of multimedia files you've played), maybe you've noticed how everything gets renamed with bracketed numbers! A perfectly reasonable "styles.css" gets changed to "styles[1].css". No problem if it's only a couple of files, but a pain if you're grabbing hundreds of files! This script will rename all the files in a single directory to return the names to normal.

Recursive Lower Case

Starts at a directory you specify and changes all file names in and below that directory to lower case. I needed this when I moved a web site onto a case-sensitive Unix web server.

Recursive No Spaces

Starts at a directory you specify and removes the spaces from all file names in and below that directory. I needed this when I moved a web site onto a Unix web server.

CRLF to CR

Converts DOS/Windows text (with CRLF line terminators) to Apple-type CR line terminators. Mostly useful as a pre-processor for other conversion programs which interpret both CR and LF as newline characters. I use it before I convert text into Palm PDB/DOC format.

LF to CRLF

Converts UNIX text (with LF line terminators) to DOS/Windows CRLF terminators. Great to fix text that got munged up during download from a *nix server to a Windows machine.

Search And Replace

Searches through any single plain-text file and replaces text you specify. Use it like this:
cscript.exe SearchAndReplace.vbs "C:\MyFile.txt" "old text" "new text"
If you don't want to use a script to do your searching and replacing, try these:
GNU Utilities Simtel Text Utilities Sbs2.com

Global Search And Replace

Starts at a directory you specify and edits all files (you specify the target file extensions) in and below that directory to replace text. I use it to fix web pages, scripts, and batch files when servers, files, or directory names get changed! As written, it crashes if it finds a file with no extension. An easy fix, but like I said, I wrote this to solve my problem. And I use extensions. So there.

Code Block Search And Replace

Just like the above Global Search script, but this one lets you replace entire multi-line blocks of code. I needed this when I needed to replace a common piece of JavaScript scattered throughout all my web pages with an improved piece of code.

Update

This is for those of us who have grown a bit too big to hand-update each web page, but are too cheap or too particular to surrender to using a real site editor. The "big boys" use special comment tags to identify html code sections, so that's what this script does. If you can invest the time to put tags in your page (like put and around your html logo graphic code), this script will run through all your web pages and update all the code between the targeted tags.

Sub Copy

Copies a single file into multiple subdirectories. I have several "user" subdirectories, and I need to distribute files to all of them. I put this script in the parent directory of the users' directories, then drop the file I want copied onto the script. I could have used the NT FOR command to do it, but scripting lets me extend the code to handle user interaction and logging.

Change File Name Case

Changes all files in a single directory you select to upper or lower case. I needed to change case when I needed a way to "mark" files. You know, kind of like a file attribute? I have files that are "guesses" and files that are "verified" and I didn't want to create a database to keep track of which category each file was in. My Win32 box doesn't care about file name case, but code can tell if a file has an upper or lower case file name! It's just like having another file attribute! Keep it in mind.

Zero Files

Sets all files in and under a given subdirectory to zero bytes. Why? Because sometimes you want files to exist(but not take up any room) just to stop automated copy or download operations from retrieving new copies.

Zero Mirror

Creates a mirror of an existing subdirectory somewhere else -- except all the copies of the files are zero bytes. This would allow you to recreate an entire CD's file system layout on a floppy disk. Maybe that floppy would satisfy an upgrade program's requirement to see the original disk? Or use the script to make a copy of a file system in a way that would allow the Windows file search function to be used. Like create an index of all your (non-music) CDs.

Sanitize

Helps to prevent recovery of files you've previously deleted. This script runs through all your fixed hard drives and fills all the empty space with spaces. Once it runs out of room on the hard drive, it deletes all the files it created. To move as fast as possible, it starts out by creating 32MB files until it runs out of room. Then it cuts back to 16MB, 8MB, and so on, all the way down to 512 bytes to make sure all empty space is filled. The use of file copying instead of file creation and a one second delay when switching file sizes seems to handle the disk caching problem pretty well. Not meant to protect you against the NSA, just against someone in your IT department with a recovery utility or sector editor.

Debug

Written to give the same output as the DOS "DEBUG" program. I used this to look into how scripting reads binary files as text streams. By keeping the same format, I was able to make easy side-by-side comparisons. Answer -- Scripting does just fine until it hits a short run of binary zeroes. Then it's lost. Now that I know, this script really has no use! Except... Maybe in a locked-down computer, the DEBUG program is prohibited. If so, you can use this script to see what type of line-termination characters are used in a a file you're having trouble with or if that file contains real spaces or those pesky non-breaking spaces.

Size

Solves a common batch file problem: How to compare file sizes. From a batch file, use it like this:
cscript.exe size.vbs "C:\SomeFile.txt" ">" "1000"
if errorlevel 2 goto ERROR
if errorlevel 1 goto FALSE
goto TRUE
It will return an errorlevel of zero if the statement is true, an errorlevel of one if it is false, and an errorlevel of two if there is an error. Operators >, <, =, >=, and <= are all valid and must be quoted. File names only need to be quoted if they have embedded spaces or other delimiters. The size value never needs to be quoted (but it can be if you want to). 

Date

Another common batch problem. How to compare file dates. Just like the above "size.vbs" except this one compares file modification dates. A newer file is "larger" than an older file. From batch, use it like this:
cscript.exe date.vbs "C:\SomeFile.txt" ">" "C:\OtherFile.txt"
if errorlevel 2 goto ERROR
if errorlevel 1 goto FALSE
goto TRUE
The above example is asserting that the "SomeFile.txt" is newer than the "OtherFile.txt". It will return an errorlevel of zero if the statement is true, an errorlevel of one if it is false, and an errorlevel of two if there is an error. Operators >, <, =, >=, and <= are all valid and must be quoted. File names only need to be quoted if they have embedded spaces or other delimiters. 

Security

Hosts File

Here's a way to automatically download, merge, sort, and remove duplicates from several different online sources to create your own "hosts" file. A hosts file is a way to prevent your computer from connecting to known "bad" web sites. It won't protect you against everything, but it's an easy way to protect against the obvious! For flexibility, you can easily modify the list of web sites whose hosts files you want to use. For fast operation, the script runs everything through a database for the sort and merge operations. To keep you running, the script confirms the state of your "DNS Service" (which must be disabled). For convenience, you'll get more than the usual "white list" and "black list" configuration options. For easy searching, the script produces a "hosts" file that is sorted by domain name (not text-sorted machine names like most other lists). Finally, (and most importantly) this is an open-source script you're free to modify and redistribute.

Proxy Access Control (PAC) File

Here's a way to automatically download and install the latest "PAC" file from hostsfile.org. In addition to downloading and installing, this script will also configure Internet Explorer to use the new PAC file. PAC files work by redirecting your browser to a non-existent proxy (your own PC) if prohibited words are found in the URL.

Homer Web Server

If you have a "hosts" or "PAC" file, you'll probably end up with error messages in your browser unless you have a specialized web server program. I recommend "Homer" from "funkytoad.com". Of course, I offer an automated Homer download and installation script that will... urrr... download and install Homer automatically.

User Access Control (UAC) Prompt

If you find yourself writing scripts that need administrative priveleges, you may have bumped up against Windows Vista. Vista will "sandbox" your script, letting your script think it successfully created files or wrote to the registry. Even XP and 2K can be a problem if you launch a script without being logged in on the right account. Here's how to easily verify the script is running under an admin account and prompt as needed based on the operating system.

Run Other Programs

Compressed Executables

If you use the batch file "START /WAIT" command or the scripting "wsh.Run,,True" method and expect a program to wait -- but it doesn't wait -- well, the most likely cause is that the program you tried to run was "compressed". What happens is that the program decompresses itself in memory, starts the new decompressed version as a separate process, then terminates itself. The START command and wsh.Run method see the original program termination and assume everything is done! If you open your suspect executable in Notepad, you may see some information about what compression program was used. The most popular compression program is UPX. It's popular because it's free and it's excellent! Luckily, UPX can "decompress" the programs it compressed. For example, Symantec's free FixBlast Blaster virus removal tool is UPX compressed and is 133KB. Both START and wsh.Run can't monitor when FixBlast ends. However, if you use UPX to decompress the FixBlast.exe program, it's size jumps to 544KB and START and wsh.Run suddenly begin working as expected! But don't panic if you can't (or aren't allowed to) decompress a program. I show a few other ways of monitoring programs next...

Wait For Title

Windows Scripting has an "AppActivate" function that will give focus to a window based on the window's title. It returns True or False based on whether the window existed and focus could be shifted there. This script uses that technique to wait for any program. The downloadable zip file includes a "test.bat" to demonstrate the script.

Wait For Exe

WMI (Windows Management Instrumentation, standard on Windows 2000, XP, and newer, and a free download for Win9x) allows scripts to check the actual executable name of all running processes. So if you know the name of the program, this makes it easy to wait until all instances of that program are finished. The downloadable zip file includes a "test.bat" to demonstrate the script.

Kill Title

This script uses the Scripting "AppActivate" function to activate applications based on their title bar text, then uses the "SendKeys" method to send an application-killing "Alt-F4" keystroke.

Kill Exe

Again using WMI, this allows you to terminate all instances of running processes based on the executable name.

Schedule

This scheduling script is useful in situations where you have several programs you need to launch, but you don't want to go through the password-changing hassle of using the task manager to launch them all. Set up the Windows Task Manager to launch this script when the computer has been idle for a few minutes. That makes it a poor-mans "service" since it will run even if you log out. And you only have to update your password one time in the task manager. And, and, and... It's only a SCRIPT, which means even in most locked-down environments, this scheduler won't have to go through an approval or exception process.

WSC

You probably don't think of a WSC as a way to run other programs, but that's exactly what I do with them. You can write scripts that run programs you don't have on your computer. You can use the code in a WSC without registering it on your computer. And you can use a WSC file without giving it a WSC file extension. A bunch of little-known items I decided to mix in with my SFX script to do some interesting things. Well, interesting to me!

Pop-Up Window Killer

An extension of the above KillTitle. I tried a popular browser popup killer, and while it worked fine, I thought I could do the same thing with scripting. So I did. Sure, it doesn't have all the features, but it works, it's free, and you can modify it easily to suit your purposes. It works by maintaining a list of "bad" window titles. If focus can be shifted to one of those bad titles, then an Alt-F4 key (or Ctrl-F4 for AOL people) is sent to close the bad window. Most popups start out with an "about:blank" window title, so that gives you a great head start.

Invisible

Shows how to use the Shell "Run" method to run any program, script, or batch file invisibly. You'll want to be sure whatever you run invisibly won't require user input, because, well, you can't click a button you can't see!

PEMenu

This script is designed to be used with the BartPE PE-Builder. PE-Builder allows you to make a bootable CDROM that can run Windows programs. There is no better way to recover from a virus or from a corrupted hard drive than from a bootable CDROM. You can add your own programs to the CDROM, but most programs require a separate "plugin" to be built so they don't run directly from the CDROM. That's a lot of work... However, if you have a collection of simple utilities capable of running directly from a CDROM, this script will build all the necessary "plugin" files for you. This one script generates one plugin that will support hundreds of your utility programs. That's a lot less work!

SHTTPD

This script is designed to be used with the open-source HTTPD web server. HTTPD recently moved over to Google as Mongoose. You can ignore all the notes about the move and still download the original SHTTPD file from SourceForge. If you want, you can ignore the installer (open it with a ZIP program) and run the 60KB program by itself. This is absolutely what you want when you need to share a file over the network with someone, but you don't want to enable file sharing or force the other person to install special software. Put my script in the same folder as the "shttpd.exe" file and you can drop a folder on the script and it will shut down shttpd (if it was already running) and re-launch it with your folder as the new web root on whatever port you want. As an excercise for the student (you!), you can edit the script to replace all instances of "shttpd.exe" with "mongoose.exe" and it will work the same with the newer Mongoose web server.

Tiny

This script is designed to be used with the open-source TinyWeb web server. TinyWeb is a single executable web server daemon. No DLL files, no registry changes, and no installer. Scripts (like PHP files) will even run if they're placed in a "/cgi-bin" folder. TinyWeb is only 58KB and has no configuration other than through the command line. If you put my "tiny.vbs" script in the same folder as the "tiny.exe" file, you can drop a folder on the script and it will shut down tiny and re-launch it with your folder as the new web root.

AbyssWs

This script is designed to be used with the free Abyss web server. Abyss is only 112 KB and uses a single configuration file and a key file. You can delete all the other files that come with it. Deleting the other files means you lose your nice graphical configuration console and have to manually edit the configuration file -- but it makes for a very small footprint! Abyss supports HTTP/1.1, dynamic content generation through CGI/1.1 scripts, Server Side Includes (SSI), and user access control (HTTP authentication/password protected files). Adding PHP or Perl support is a matter of a few clicks. If you put my "abyssws.vbs" script in the same folder as the "abyssws.exe" file, you can drop a folder on the script and it will shut down the Abyss web server and re-launch it with your folder as the new web root. If you're using the most recent version of Abyss, I've included some "wizards" to set up your installation to support PHP, WSF, or VBS as CGI scripts. It's not that hard to set up manually, but it was fun automating it.

Serial

MsComm32

An HTA and VBS script example to show how to do serial communications with a script. The trick is to use the "mscomm32.ocx" control used by VB5 and VB6. That control, unfortunately, required a developer's license to use with a script, so it got wrapped with "netcomm.ocx" to solve the licensing problems. The SFX method is used in order to put these needed OCX files in the script so they can be extracted and installed as needed. Under VBS, the communications is handled with "events", while under HTA, it gets handled with polling.

Graphical User Interface

Progress Bar

Use Internet Explorer to create a graphical progress bar you can control from your script.

Browse for File

Automatically use the "Shell.Application" where you can, and use Internet Explorer where you can't. Either way, you can offer the user a simple graphical way to select a file. BAD NEWS: The "Shell.Application" file browsing trick used an undocumented value (8192 or 16384) to get a reference to a file. This doesn't seem to work reliably under XP.

Choose One

Use Internet Explorer to present the user with a pull-down list of choices.

Text Entry

Use Internet Explorer to allow the user to enter multiple lines of text.

Etext Utilities

TXT2EPUB

This is the simplest text to epub ebook converter I know of. Everything else I found either has too many settings, mangles the text, or won't run on my old Windows 2000 computer. So I wrote this converter! Drop a text file on the script, confirm the script's guess for title and author, and you're done. If you want to get more advanced, there are plenty of options you can muck with. You can even make it simpler by telling it not to bother asking you to confirm the guesses it makes for title and author. After all, a book is still readable even with those values wrong. It's completely up to you. And (of course) since it's a script, you can modify it to work the way you want.

Articles

This script was written to allow me to download and convert online stories, news and opinion articles. The idea is that after I use this script to get the text all in one place, I convert it and put it on my Palm so I can read it during slow times. This script just delivers plain text, so it can be used to feed Palms or PocketPCs or text readers. Great for people like me that are too cheap to pay for AvantGo. Comes complete with sample batch files that will download USA Today, PC Magazine, the San Jose Mercury News, Security Focus, Scientific American, Science News, Discovery, Asimov's, Analog, Fantasy & Science Fiction, the Infinity Plus web site, and more! I add another site every time I run out of reading material. BONUS: I include a sample script that merges this "articles" script with the below "makedoc" script to do the complete download, conversion to Palm format, and launch of the Palm installer.

MakeDoc

My favorite command-line Palm text conversion utility, makedoc.exe, is almost impossible to find on the web. Worse, some companies lock their computers down and won't let users install any extra programs and utilities. This simple script should fly under the radar of any lock-down policy and allow you to convert plain text into the standard Palm "doc" pdb format. The only shortcoming is that it doesn't do compression.

Unwrap

If you visit the newsgroups (like alt.binaries.e-book), you'll find several raw book scans. They look just like book pages. Absolutely not ready for conversion into anything. This script unwraps the text, removes the page headers and numbers, cleans up hyphens, corrects some common scanning errors, and generally goes a long way towards making the text usable - all with no user interaction. The script ignores any file that appears to already be unwrapped. If the script is run with cscript, it displays it's status. A DOS comand like "cscript.exe unwrap.vbs MyEbook.txt" would clean up the ebook "MyEbook.txt". If you want, you can also drag etext files and drop them on the script.

UnGutenberg

Creates a Palm PDB file from a Gutenberg etext file. All the classic stories you were supposed to have read in high school and college are available via Gutenberg. All the classic poems and fairy tales you want to read to your kids are also there. Thanks to the Palm, you can take them with you and not have to read them on a monitor or print them out (both really bad options). This script unwraps the Gutenberg etext, "sanitizes" the etext by removing all the Gutenberg "small print", and tries to set the Palm document name to match the actual book title. Accepts both raw text and zipped files as input. Needs PKUNZIP and MAKEDOC in the path.

Text to Speech

Speech Overview

Microsoft offers two ways of programming text-to-speech applications: SAPI 4 and SAPI 5. I believe SAPI 4 can be installed on everything from Windows 95 on up. Windows 2000 has SAPI 4 pre-installed (but it is virtually always broken) and XP has SAPI 5 installed. Both typically only have one voice. Install or re-install SAPI 4 from here (it's only 825KB). Even though you install SAPI4 correctly, Microsoft will fail to "register" all the DLLs correctly. You will need to run a command like this to fix things:

FOR %X IN (%WINDIR%\SPEECH\*.DLL) DO START /WAIT %WINDIR%\SYSTEM32\REGSVR32.EXE %X
Alternatively, you can double click each DLL in the Windows / Speech folder and select the "Regsvr32.exe" file when asked what program should be used to open DLL files. You can find several very good SAPI 4 voices at the Microsoft Agent user download page. I like the American English and British English voices. Very good stuff. Although Microsoft no longer offers SAPI 4 voices, you can still use your favorite search engine to search for the voice installers "mstts.exe" (md5-abf611660b32354c0d158aa00cf64479) and "msttsv.exe" (md5-e7298029e22b49f65dbbb052c1d5513c). These installers will load you up with lots of special effects voices. Robots, echoes, whispers, that sort of thing. Kids love them.

As far as SAPI 5, the only two ways I know of (from Microsoft) are:
  1. Install the entire Speech SDK 5.1 (68MB). That gets you SAPI 5 and three voices... and a bunch of samples that can't be removed. No, the voice quality is no better on SAPI 5 than on SAPI 4. The one big difference is that SAPI 5 allows you to easily convert text directly to an audio file without having to play it and record it.
  2. Install Microsoft Reader, then install the Microsoft TTS component. The TTS installation does require Reader to be there. I haven't found a way around that. But having Reader is a lot less overhead than having an entire SDK! Unfortunately, the "Reader" route only gives you a single voice.

Speech Test

This HTA file will give you a report your computer's voice capabilities. It will provide links to allow you to fix any problems it finds. Which means you don't have to understand how to register the speech DLL files (the green text above). You can just point and click your way through the repair.

Speak

This script will read any plain-text file out loud. It really, really tries to convince you to run it with CSCRIPT so you can see the text displayed as it's being read. You must have SAPI 4 or 5 installed. If you don't have voice capabilities, the script will prompt you to download SAPI 4. This sript is rather crude. Both the SAPI SDK downloads have equivalent utilities that do the same thing.

Story Reader

This is an HTA file that extends the above "Speak". Extends it quite well, thank you! By using an HTA, StoryReader can speak and display text without having to worry about which engine (cscript or wscript) it is running under. StoryReader also does smart unwrapping and sentence identification, allowing you to use almost any format of plain text for a story source. StoryReader accepts command line arguments allowing you to specify which file to read, a starting point in the file, and what voice to use to read the story. Because nobody likes command lines, I've also included an HTA called "VoiceChooser.hta" that lets you easily select which voice will read your stories. But wait -- there's more! StoryReader and VoiceChooser both contain the voice repair capabilities found in the above "SpeechTest". Also, I've included another file called "Menu.hta" that will automatically create clickable links for both of the other hta files and for all your stories!

Voice Test

This is the "Hello World" of text-to-speech. It checks seven different text-to-speech objects (six SAPI 4 and one SAPI 5), and checks every voice available to each object. It tells you which objects succeed or fail, and it will identify and speak in every voice possible.

Text To Wave

This script will save any plain-text file as a WAV file. You must have SAPI 5 installed. If you don't, the script will suggest you download the SAPI 5 SDK. Create your own "books on tape" (or on CDROM). SAPI5 allows you to save to virtually any format of WAV file. I've built constants for the most common choices into the script.

Graphics

Array To Bmp

Creates a 16-color BMP (Windows Bitmap) file from an array. BMP files can be displayed as inline graphics by Internet Explorer, Mozilla, and by virtually all graphics programs.

Array To Xbm

Creates a black and white XBM (Sun Bitmap) from an array. XBM files are plain text and can be displayed by Netscape and Internet Explorer. Traditionally, XBM is used to display small icons. The XBM files this script produces require 6 bytes per pixel. The disadvantage of the large file size is balanced by the universal browser support. IE will only display XBM files locally if they are associated with mime type "image/x-xbitmap". Very few Windows graphics programs can be used to work with XBM files ("IrfanView" at www.irfanview.com is the easiest, but also try "The Gimp" at www.gimp.org and the command-line "ImageMagick" utilities from www.imagemagick.org).

Array To Pbm

Creates a PBM (portable bitmap) in version 1 format (black and white, plain text) from an array. The PBM files produced by this script require about 2 bytes per pixel. PBM files can be displayed in Mozilla and by most decent graphics programs.

Web and Thumbnail Creator

Takes a folder full of your JPG digital camera photographs and creates web-sized (or email-sized) JPEG photos and smaller GIF thumbnails for all your photos. The script uses the EXIF data present in your camera photos to automatically rotate your new web and thumbnail pictures the correct way. Your original pictures are never modified. I wrote this script to automate the conversion of photos for web-based slide shows. The script needs (and you'll need to get) the free "GflAx" ActiveX object from XNView. If you want more customization than this fully automated script delivers, you might want to check out the following two scripts...

Thumbnail Creator

Takes a folder of pictures and creates thumbnails in the same folder. You get to pick what size and file type the thumbnails will be. Uses EXIF data (if present) to insure the thumbnails are rotated correctly. This script will offer to download the "GflAx" object if you don't already have it. Of course, you'll probably need administrator priveleges in order for GflAx to be used (because the script registers and unregisters it on an as-needed basis).

New Size Creator

Takes a folder of pictures and creates new SMALLER pictures (for email or web use) in the same folder. You get to pick what size and file type the new pictures will be. Uses EXIF data (if present) to insure the thumbnails are rotated correctly. This script will offer to download the "GflAx" object if you don't already have it. Of course, you'll probably need administrator priveleges in order for GflAx to be used (because the script registers and unregisters it on an as-needed basis).

OS (ADS) Comment to JPG Comment

Pass this script a JPG file and it will replace the Operating System Comment (Right-click / Properties / Summary / Comments) with a JPG comment in the file. This makes comments transportable across thumb drives and CDs. The normal operating system comments are stored in "alternate data streams" and won't usually transfer to FAT drives (thumb drives) and CDROMS, and probably won't make it through your email client. Moving the comment into the JPG file allows for portability.

Read JPG Comment

his is a "stub" of code that simply shows the comment. It's expected you'd modify the code to do something more spectacular. As written, it returns the first of:
1 - Operating System Comment (right-click / properties / summary / comments)
2 - JPG Comment
3 - IPTC Caption
4 - IPTC Headline
5 - EXIF User Comment
6 - EXIF Image Description

Multimedia

ID3

This script was written to support creating and adding to ID3V2.3 tags for MP3 files. Specifically, it was created to add pictures to MP3 files through the command line. Turns out most command-line MP3 creation tools (like "lame" and "ffmpeg") can write text tags, but nobody writes pictures. At least not that I could find. So this script was born.
As a side benefit, this script supports writing all kinds of tags nobody else seems to be able to read or write... which doesn't sound like much of a benefit when you put it that way. Did you know you can embed unlimited arbitrary binary files in an MP3? Did you know you can store your private configuration data in there too? And you can store twenty different pictures (or more if you break some rules) that nobody will ever see? And, since nobody is set up to read this obscure stuff, it beats me how you'd ever get the data out that you put in. But I gave you the ability to put it in anyway.
If all the complex stuff is a bother, take heart! There's a "simple mode": If an MP3 file is dropped on the script and a JPG file exists in the same directory as the MP3, then the JPG will be added to the MP3 as cover art. If there are several JPG files, the newest one will be used. No special JPG file name is needed.

2Phone

If you have a movie or a folder full of movies you'd like converted so they'll play on your phone, this should help. It was made for Media Center "dvr-ms" recordings, but it will work on most other files as well! Most phones (well, my phone at least!) will play MP4/H264 files, so that's what this script produces. Subtitles and movie descriptions are embedded directly in the movie file for convenience (where they can be enabled and disabled by your player), but SRT subtitle files are preserved in case your movie player needs them. If your movie player doesn't like separate of "soft embedded" subtitles, the script can optionally "hard embed" the subtitles directly into the video. Drop a movie file or a folder full of files on the script and let it work! If you'd like, run the script with no arguments and it will set up (or undo) a right-click association for any desired video file type. The script is really a front end for a half-dozen other programs, the locations of which are documented both in the script.and the "ReadMe" file.

MP3 Tag

This script will "tag" all MP3 files in a folder. It was written to add basic information to podcasts which were downsampled and stripped of the original tags. If run without arguments, the script will toggle the registration of itself as a right-click option on folders. Alternatively, you can manually supply the script with an argument by dropping a folder on the script. You can set the title, album, artist, and genre, which must all be identical for every MP3 file in the folder. The track number will be automatically entered based on the first number in the file name. For track number purposes, dashes are not counted. For example, a file named "Song-01-32-Album.mp3" would be assigned track a number 132. Requires Java and jampal.jar (tested with jampal-1.20.jar)

Slide Show

If you have a collection of sound files with matching pictures (in other words, pictures with recorded narration), this script will create the HTM web pages needed to display your files in a framed JavaScript self-advancing slide show. The narration in your sound files will play while the matching picture is on-screen. Just run the script and answer a few questions. Every question has a default answer already given, and in most cases you'll be able to simply accept the default. The script was written to work best on Windows with Internet Explorer, but it degrades gracefully (losing the auto-advance feature) on other browsers and operating systems.

Gallery Generator

If all you want to do is show off your pictures, this script creates a simple index page for you. It assumes you have full-sized photos and smaller thumbnails in the same directory (if you need to create thumbnails, try the above Thumbnail Creator script). Clicking the thumbnails takes you to the full-sized picture. Very straightforward.

Text Slide Show

If you have a collection of pictures and (optionally) related plain-text files, this script will create all the HTM web pages needed to display your files in a framed JavaScript slide show. You don't need to know how to create a web page! The script will match up your pictures and text files by name and create all the web pages for you.

Basic Slide Show

If you don't want frames or JavaScript, this is the slide show you want. You can have any combination of pictures, sound, and plain text files. That means you can have just pictures, just text, both, just a sound, or, like I said, any combination! What you don't need are web pages! The web pages will all be built for you. If you've ever seen the fairly basic layout used by a PowerPoint web slide show (with simple forward and back buttons on the top), then you're pretty close to what this script will deliver for you. Except you don't have to buy PowerPoint!

Slideshow And Index Page

If you like the idea of the versatile "Basic Slide Show" above but also want an automatically generated index page with thumbnails to go along with it, this might work for you. Although I added the thumbnail index page creation feature, I took out all the other options. As a result, you have to keep all files in a single directory and you lose some of your file naming flexibility. To allow the script to identify related images, full-sized images must be JPG, web-sized images are JPEG, and thumbnails are GIF. That's actually pretty easy to deal with because I wrote the Web and Thumbnail Creator script to automatically create and name thumbnails and web-sized images with the correct names and file extensions. Using these two scripts allows you to build a complete web-based presentation starting with no more than a collection of full-sized digital camera photos.

Virtual Dub

Creates a jobs file for the free video editor VirtualDub. With this script, you can save your settings and have those same settings applied to every video file in a directory. I wrote this because I had lots of video captures I needed to process.

Make ASX

Run this script and point it to a bunch of movie or sound files and it will create an ASX file which will allow you to use MediaPlayer to play them sequentially.

Make SMIL

Run this script and point it to a bunch of movie files and it will create a SMIL file which will allow you to use QuickTime or RealPlayer to play them sequentially.

Smil Time

If you use Windows XP Media Center with DVR2WMV, you end up with WMV movie files and separate SMI files containing the subtitles. Unfortunately, all the subtitles seem to be off by several seconds. This script allows you to correct the timing in the subtitles in those SMI files.

Jpg 2 Asx

Run this script to create an ASX slide show from a directory full of JPG, GIF, PNG, or BMP pictures.

Repeat ASX

If you'd like to set up an infinite loop of media files (either a single sound or video file or an ASX collection) you can drop your existing media file on this script. A new ASX file will be created which will give the appropriate repeat command to Windows Media Player.

Avi To Htm

Creates an HTM file for each video file in a folder. Should work forAVI, MPG, MOV, WMV, and more depending on client capabilities. It uses two unusual approaches. First, it uses IE's <img dynsrc= tag for the video files. This causes the videos to be displayed just like an image: raw with no player controls. Non-IE browsers fall back to using the embed tag for the Media Player plugin (again with no controls). Of course, this means I have to have some sort of browser detection script. But I didn't want to use scripting! Luckily, I remembered IE's "conditional coments" which class IE5 and newer in one group, and all other browsers in another group. Close enough!

Wav To Htm

Creates an HTM file to match every multimedia file in a folder. Handles AVI. MPG, MP3, or any file that can be played with Microsoft's Media Player. The created HTM file has the usual OBJECT / EMBED code to insure your file plays in all browsers. This can be handy to insure multimedia files stay in the browser and don't cause a download or spawn a separate player.

Gallery Browser

Think of it as a manually advanced browser-based slideshow where you can preview thumbnails of all the images. The best part is you don't have to create the web pages or the thumbnails. Just tell the script (when it asks) where your folder of pictures is and it will create "index.htm" and "select.htm" files which will allow you to browse all the images in a framed setting. The HTM files that are created contain relative links, so they'll work whether you upload them to your web site or keep them on your hard drive.

Fli Player

This script can be used as a command line or drag'n'drop FLI animation player. Actually, all the heavy lifting is done by a Java program written by Jörg Anders from http://rnvs.informatik.tu-chemnitz.de/~jan/FLI/FlicFile.html. I don't write Java, so I just compiled the source code and embedded the resulting class files in the script. The script's job is to extract the class files and create a web page on the fly. Then it launches Internet Explorer, displays the page, and cleans everything up afterwards. All you have to do is drop an FLI file on the script. Assuming you can find any FLI files.

Download Utilities

Slurp

If you find a web page (like the clipart collection at http://www.kamsart.com/clipart/free-clipart-Navy.html) that has lots of links on it -- and you want to download all the linked files, this will help. Just supply the URL of the web page, the folder on your hard drive where you'd like the files stored, and the file extension of the files you're after. The script does the rest.

Gallery Thief

This is a collection of several scripts that can grab all the images from popular image galleries. Many image galleries have so many pictures you just don't have time to locate, select, and download your favorites. It's easier to just download the lot overnight and sort them offline later. This is NOT a simple web site mirroring program. It ONLY downloads the JPG files (actually, files with mime types of "image/jpeg") and it puts them all in the same folder on your hard drive. To prevent name collisions (and help you remember where you got the pictures from), the files are typically given names that reflect their URL (but you can change the naming convention). If you have to quit, the script will pick up from where it left off when you start it up again. One big advantage of doing this with a script instead of with a "real" program is that scripts run invisibly (unless you say otherwise). You figure out how that might benefit you. On the other hand, if you make the script run in an "Open with Command Prompt" cscript DOS box, the script will give you a status display so you know how things are going.

Clipboard Download

If you only want to grab a few links from a web page, it's easy to just do a right-click and save the linked content. But if you need to rename the downloaded files to prevent name collisions when downloading from several different web pages, it gets bothersome. This script allows you to copy a URL (web link) from browser, then run the script to automatically download and rename whatever the clipboard URL points to. Of course, there's a few options to let you select what folder you want the files stored in. The script is even smart enough to download videos from several different web sites -- knowing only the URL of the web page displaying the video.

Wget

Back in the days before broadband, if I tried downloading more than two files at a time, my download speed per file would drop so low that servers would drop me. I tried a few of the automatic download managers and didn't like the built-in ads or the instability they caused. All I wanted was a simple sequential downloader. So I wrote a script. Here's how it works: You drag links out of your browser and drop them into a designated directory. You choose the directory (it can even be the desktop). The script will download the files associated with the links into another designated directory. Again, you choose the download directory. As the files are downloaded, the shortcuts to the links you originally dragged are deleted. If you run the script with WSCRIPT (right-click the script and select "Open"), it runs totally invisibly. If you run it with CSCRIPT (right-click and select "Open with Command Prompt", it gives you a status display of what it is doing. Your choice. If you have to turn off your computer before your downloads are finished, the next time you start the script (and point it to the appropriate folders), it will re-download any partially downloaded files and continue until all your files are downloaded. Now... Why the name Wget? Because originally Windows didn't have a decent download object. So I had to use a separate utility named Wget. Not being particularly clever when it comes to names, I decided to name the script after the utility that did all the hard work. The script has since been rewritten to take advantage of the WinHttp object in Windows 2000 and XP. Wget is no longer needed, but I kept the original script name.

Download Ftp

This FTP download program doesn't require you to have any extra utilities. It automates the built-in FTP client that ships with all versions of Windows. It was written to allow me to make daily FTP downloads of a text data file over my company intranet. NT/XP/2000 users will have to modify the embedded FTP command line to point to the correct location of the FTP program.

Get Web Page

This is actually a library of several different functions all with the same name designed to download the text from a web page. You pick which one you want and delete the rest. I have several CGI web pages on my company intranet that contain data I automatically download using these functions.

Binary Download

If you want to download something other than text over HTTP, it gets a bit more complicated. Scripting isn't really designed to handle "binary" files. But it can be done! Here I show the "correct" method for doing it and two other very unusual methods for doing it. Stay away from the unusual methods -- they are just for fun.

Encoding Utilities

Zip

How to create ZIP files strictly from VBS. True, this script only creates uncompressed zip files, but that still counts! To make it easy and flexible, this code only accepts a folder as an argument. It will zip whatever it finds inside that folder (including subfolders). The created zip file's name is based on the folder name. While it's true that XP and newer natively handle zip files, they don't support adding uncompressed files (which is needed for ".epub" ebooks).

SFX

Convert any file into a self-extracting VBS file. When you run the VBS file, the original file will be "extracted". That's useful enough. And pretty handy. 

SHAR

Similar to the above SFX scripts, but... different. More generic. More useful! And two different versions! Batch and Scripting! Like the SFX scripts, SHAR creates a self-extracting file. By choosing which version of SHAR you run, you can create a VBS self-extractor or a DOS BATCH self-extractor. Unlike the SFX script, both versions of SHAR exclusively use ADO instead of an embedded "helper" file to read binary files. That makes the SHAR scripts a lot easier to understand and maintain! Another difference is that while SFX only extracted a file to the script's directory, the SHAR VBS version allows you to browse to your desired extraction folder. The SHAR BATCH version only extracts to the "current directory", but that's the price you pay to be compatible with everything all the way back to DOS version 6. Both versions of SHAR generate archives that are optimized to stay under 80 columns wide. As a result, the text from a SHAR archive (VBS or BAT) can be copied and pasted into the body of an email, then be copied and pasted back into a VBS or BAT file (as appropriate) on the receiving end. This effectively allows file attachments where attachments aren't allowed or where separate decoders may not be available. FYI, the "shar" name of this script is taken from an old UNIX command "shar", which stands for "shell archive". In other words, an archive that can be extracted using nothing more than the "shell", or built-in operating system commands. Which is exactly what these SHAR scripts create.

SCEN

This is a VBS only (no WSC scripts!) script encoder. Take a working script of yours and drop it on SCEN. SCEN will turn it into a virtually unreadable mess that will still run. If you aren't allowed to install the genuine Microsoft script encoder -or- have to be backwards compatible with older (Win95 and original Win98) versions of scripting -or- only need casual protection from prying eyes -or- need to change your script so it doesn't contain sensitive words, then SCEN might be handy. SCEN will create a script with lots of hex data, a bare-bones hex decoder, and the obligatory "ExecuteGlobal" command. Thanks to ExecuteGlobal, your decoded file is run directly from memory and is never written to the disk. Pretty darned simple. And your script will still work! It even works if you run it through the encoder several times.

UrlEncode (online)

Online URL encoding because I needed it available on my phone.

Url Decode

Allows you to see what URL someone is trying to hide from you.

Rot13

Just rotates letters. A becomes N, B becomes O, and so on. Netscape mail has built-in support for viewing ROT-13 text, but darned if I could find an easy way to encode text.

Decode

Internet Explorer only. Encodes and decodes everything, and does it with a slick interface. Alex Angelopoulos (alexangelopoulos at hotmail.com) took my URL decode script above and wrapped it up in an HTA file. Then (bless him!) he sent it to me. His hta reminded me that scripting really has a lousy user interface, but HTA files allow you to create applications with the power of scripting and the user interface of web pages. After my initial embarrassment at having ignored hta files for so long, I tried my hand at extending Alex's example. After realizing I didn't need the security priveleges hta files have, I just gave it an ordinary htm file name. If you save it to your hard drive, you can give it an hta file extension to force it to open with IE (MSHTA, actually) if you normally use some other browser. Not to be outdone, Alex has continued to work on and improve his original hta. He now calls it string-o-matic and he's turning it into universal web un-munging tool.

UU Decode

Just playing around. When I get the encode and decode both complete, I'll move it into the above Decode.htm file. Meanwhile, you can use this to decode UU text.

Upload Utilities

Wiki Uploader

If you have a script that creates text for a Wiki page (like to post tables on a Wiki at work), this script illustrates how to automatically upload it. Actually, this script uses http://test.wikipedia.org/wiki/Sandbox as the upload target, so you can play with it. It will be up to you to edit the script to point to your Wiki. NOTE: This script is intended for Intranet (company network) use only. It would be just plain stupid and very rude to use it on an Internet Wiki.

Make Ftp Script

I have too many web pages to keep up with. I may modify a dozen files in as many directories over a period of days before I upload the changes. And then -- oops. Which ones did I modify or create since my last upload? This searches for modified files (based on the archive bit), then creates an FTP upload script. It doesn't actually upload anything, it just creates a script batch file. Running the batch file will do the actual upload. It includes an undo batch file to reset the archive bits in case you change your mind. Using the archive bit is very appropriate because you don't need to back up anything that has been uploaded to the web (The web is your backup!). NT/XP/2000 users will have to modify the embedded FTP command line to point to the correct location of the FTP program.

Ftp Upload

No interaction version of the above script. This one will actually upload all modified files in and under a specified directory in one shot. Automatic undo if it can't connect to the FTP server. Log files are always kept of action and results. Can be run visibly or invisibly. So -- after you get comfortable with the above script, you switch to this one. Edit seven values (Simple things like strRemoteSite = "ftp.calweb.com") and you're home free! Use this script to make life easier for yourself. NT/XP/2000 users will have to modify the embedded FTP command line to point to the correct location of the FTP program.

Ftp File Upload

Very basic version of the above script. Again with no user interaction, but it only uploads files you designate, and it puts them where you designate. You have to build the source and destination file names into the code. This is more appropriate for giving to "content creators" that are only responsible for creating or updating a few files. To simplify things, this script does not check for or change archive bit status. This is really little more than a template that will require considerable rewriting on your part. And honestly, since you are ignoring the archive bit, you could simplify things even further by writing your own FTP batch file rather than having the script do it for you.

Web Server Upload CGI

This one is HTTP POST upload. I was frustrated over the lack of a simple file upload capability in IIS5. I tried Microsoft's NT4 upload acceptor for about ten minutes before I was overcome by the smell. I was too cheap to pay for a good commercial upload control, too lazy to invest time in the BinaryRead method, and too vain to allow someone's else's free upload control to display their logo on my web page. So I wrote my own.

Database Utilities

Access.hta

Internet Explorer only. Simple table and query viewer for Access 2000 for people who don't have Access 2000. You don't need Access or Office on your computer! Microsoft gives away the database engine, and writing a simple front-end isn't all that hard. Tables or queries with more than about a couple hundred records take way too long to display, but hey -- I said it was simple!

Odbc.hta

Internet Explorer only Simple database and table viewer for ODBC databases. Heck, you can even turn a collection of ordinary text data files into a complete ODBC database you can query! Think of this as a poor substitute for the awesome and free WinSQL program. But if you have a locked-down machine or you need a quick, free, open-source viewer, (or you just want to steal my sample code), this might help you out. Rename this file with an HTA file extension if your default browser isn't IE or if you want to bypass the ActiveX dialog.

Mdb To Txt

Converts Microsoft Access queries or tables into plain text. Originally written so the output text could be converted into Palm DOC format or linked into another database. If you use tabs as the separator characters, the resulting tab-delimited file can be given an XLS file extension and will open fine with Excel on most systems. Which means you can also consider this to be an automatic Access to Excel converter. The script is hard-coded to use Jet for Access 97 (change the reference to "DAO.DBEngine.35" to match your DAO version). Pass it an MDB file name, query or table name, output text file name, and formatting data (comma-separated max field lengths and desired output field separators):

"MdbToTxt.vbs" "Database.mdb" "QueryName" "Output.txt" "32,32,32,32" "---"

Miscellaneous

Miscellaneous Snippets

A collection of my boilerplate VBScript functions.

GPX2KML

My wife asked me to convert a geocaching.com GPX file of geocaching sites she got from a friend into a KML file so we could look at it in Google Earth or import it to our Google Maps. She gave me two hours. I took two weeks. I didn't like the output format of the various GPS file conversion programs out there, so I wrote my own. It's my first real attempt to both decode and encode XML using native Windows functions. Just drop a GPX file on the script and it creates a matching KML file.

HOSTS File Utilities

If you use your HOSTS file to block bad sites, you might enjoy a few scripts and batch files I wrote to help you manage your HOSTS file.

SNPP and SMS

A cute way to send a text message to a cell phone or pager from Windows 2000 or newer. It may not work on all carriers, but it works for Nextel!

Activity

If you have a forced screensaver, logout, or workstation lock policy, this simple script can stop it from happening! This script hits the "shift" key once every ten minutes. That's too easy!

Netstat

Mostly just a GUI wrapper for the command-line NETSTAT program. The value-added is that it refreshes every two seconds and only counts from when the program is started.

Brute Force Dictionary Generator

This script will create a dictionary useful for brute-force password attacks. One word will be placed on each line. You can specify how big the password is as long as it doesn't exceed 8 characters. All 95 keyboard characters are used by default. If you want to exclude certain letters, numbers, or punctuation from the generated words, you'll need to edit the script. WARNING: The files generated by this script get real big, real fast. For example, with 95 possible characters and a 4 character password, you get a 500MB file. If you're foolish enough to try to make an 8-character password list, there won't be enough disk space no matter who you are. The huge file size explains why nobody offers dictionary files like these for download.

Windows 2000 Performance Monitor

Ibrahim Niazy shows how to use Windows Scripting to organize the reams of data the Win2K performance monitor spits out.

Register and unregister your script as a right-click option on folders

Stephen Webster Cocks gives us an example of the right way to distribute scripts. Running it with no arguments automatically installs it as a right-click option on folders (with lots of nice sample registry code). If it is already installed, running it with no arguments will uninstall it. The actual point of the script is to create a shortcut to the selected folder. While you may not need that, you will want to pay attention to the concept of building install and uninstall capabilities into your scripts! Unfortunately, McAfee with heuristics enabled will falsely detect a generic unknown virus in this code. My feeling is that it's unavoidable because the script copies itself into the Windows directory and makes registry changes. Good luck modifying the code to avoid the false virus hit if you plan to redistribute code like this. Sorry!

Determine Sizes of All Subdirectories

Drag a folder onto this script (or install it as a right-click option) and it will tell you the size of all subfolders. Great for determing which folders can get backed up to a CD. I wrote this because under Win95, getting the properties for a folder to determine it's size fails -- it rolls over and starts over when it hits 2 gigabytes. Because it actually adds the file sizes of every file in every subdirectory, it isn't particularly fast, but at least it is accurate! Displays results as a pop-up box, but falls back to displaying as a text file if there is too much data to fit in a simple display box.

Find the CDROM

A script made to be used from a batch file -- but you can simplify it to stay in the scripting world. Finds the first drive letter that corresponds to a CDROM drive.

Print Web Page With Word

Illustrates how to automate Word to print a web page. My web page. Well, until you modify the code!

Make And Run Batch File

Shows how to create, run, wait for, and delete a batch file from scripting.

User In

Shows how to create, run, wait for, and delete a script from a batch file. In a perverse twist, the created script has to in turn create a batch file of it's own in order to communicate results back to the original batch file. Why bother? Because it provides a really nice way to get user input in a batch file!

YC

Windows 2000/XP only! One thing I missed when I got moved from Win95 to Win2000 was the ability to single-step my batch files with the "command /y /c" command. Unfortunately, Win2K doesn't seem to have a way to single-step batch files. Not even if you try using an old copy of Win95 command.com! So I wrote this script. It works by constructing a special debug version of your batch file, launching it, then putting everything back to normal after the batch file finishes. It isn't the same as what I could do in Win95 (it won't single-step a "call"ed batch file), but it beats the heck out of watching programs crash and close before you can analyze things! It also adds "//x" to the command line for scripts to launch them with the debugger. Just drop a batch file on the script and start stepping through.

Compare

Someone asked how to compare two numbers from a batch file. As long as both numbers have the same number of digits, you could "echo" them into a file, "sort" the file, then use "fc" to see if the file changed. But what fun is that? That takes six lines of batch code. By using this script, you drop down to three lines of batch code AND you can use any operator (>, >=, =, <=, <) and you don't have to have same-length numbers (you can properly compare 003 and 4). So what if I used 60 lines of scripting to accomplish this trivial task?

Send Email

Self-defense information to help you (and me) out because I get asked how so often!

Scriptable Controls

Find Your IP Address

If you want to find the IP address of the computer your script is running on, this ActiveX DLL can help. Even better, do it natively.

Read Binary Data

An ActiveX DLL needed if you want your scripts to be able to read binary data (like a GIF picture or Excel file).

Convert Byte Array to String

An OCX that converts byte arrays to strings 2 to 3 times faster than native VBScript.

Web Server CGI Programs

BMP Page Counter

Ordinary ASP that creates a single bmp counter image containing multiple digits (instead of a separate graphic for each image) representing how many times your web page has been hit. Why ASP? Why BMP? Well, not everyone has (or wants to use) a .NET server. Ordinary ASP is easy to come by even on old surplus NT systems. And of course, it's still supported on all the modern Windows servers! As far as BMP, it's possible to use ordinary string processing to splice multiple digits into a single graphic. Not trivial, mind you, but possible. That means you don't need any graphics libraries on the server, and that's a big plus if you're using a hosted server where you don't have permission to install libraries. Just as important, the BMP image format is handled just fine as an inline image on all modern browsers. The count data is maintained in an Access database, which works out for me because my web host 1and1.com has a $9.99 Microsoft hosting package that includes Access support. For that price I can host a boatload of domains and let someone else worry about backups and blackhats.

XBM Page Counter

A CGI script or ASP (your choice) that shows a single XBM graphic containing multiple digits (instead of a separate graphic for each image) representing how many times your web page has been hit. Hit count data is stored in an Access database. The advantage of XBM graphics is that it is trivial to splice several separate digits into a single graphic. Maybe you've never heard of the XBM graphic format, but your browser probably has!

Chat CGI

A VBS chat CGI. Pretty straightforward. Displays the last 50 comments, allows users to enter new comments, and stores everything in an Access database via DAO.

Web Server Upload CGI

Yes, this is the same item I "cross-posted" above in the FTP upload section. It's there because it's an upload program, but it's here because it isn't FTP. I was frustrated over the lack of a simple file upload capability in IIS5. I tried Microsoft's NT4 upload acceptor for about ten minutes before I was overcome by the smell. I was too cheap to pay for a good commercial upload control, too lazy to invest time in the BinaryRead method, and too vain to allow someone's else's free upload control to display their logo on my web page. So I wrote my own.

Lost? Look at the site map.

Bad links? Questions? Send me mail.

Google
Yahoo
Ask Jeeves