If you don't know about VBScript
VBScript (VBS) is a Windows scripting language: programming code that can be written as a text file
and executed like a program.
VBS can be used in 3 different ways: For programming scripts in Windows,
in webpage code as "DHTML" and server-side with ASP.
Each usage is
different from the others, almost like 3 different languages. It's all referred to
as simply "VBScript", which could be confusing if you're not familiar with it. For example, you might buy
a book to learn VBScript for Windows and find that the book covers only
webpage scripting and leaves out many VBS functions. Conversely, you might
buy a book to learn webpage scripting and find that it deals mainly with Windows scripting and does not cover
such things as webpage document properties.
The 3 uses of VBS
Windows OS -
VBS can be used for file operations, writing to the registry, running programs, making shortcuts,
creating automations, etc.
Webpage scripting - VBS can be used like javascript for DHTML ("Dynamic" HTML).
It is not practical for use on the Web because it is a Microsoft script language and only
Internet Explorer can interpret it, but Internet Explorer can be used on a local computer or
intranet as a way to provide a graphical interface for VBS. In that usage VBS is used with
the Internet Explorer Document Object Model (DOM) to populate list boxes, respond to
buttons, etc.
ASP - VBS can be used for server-side scripting in Active Server
Pages (ASP)
The samples here include mainly VBS for Windows and several VBS utilities written as DHTML
webpage programs.
A note about WMI:
WMI (Windows Management Instrumentation), also known as WBEM, is a system that comes
pre-installed on WinME/2000/XP. It provides a number of functions to script that are especially of interest to
network administrators, such as reading logs and managing NT services on remote computers. For some operations
WMI can make the job much easier than the equivalent in VBS. On the other hand, WMI requires learning a new,
very complex system with an entirely different syntax from standard VBScript. And for systems that do not need
WMI (and may not have it installed) WMI could represent an unnecessary, additional security risk. (WMI is not
known to have specific security problems, but neither did DCOM, ActiveX, or HTA before problems
were discovered.)
Functions that might be performed with WMI
can generally be performed with the scripts and/or components available here. In some cases
script may even provide more thorough methods. For example, the WMI Installed Applications
classes are merely wrappers for Windows Installer, which can be accessed directly through the
WindowsInstaller.Installer object, as demonstrated in the
Enumerate Installed Software scripts.
But WMI is used in a few of the scripts here: The WMI Registry class wraps the somewhat awkward
WMI Registry functions in a more usable wrapper. Also,
the XPFix utility uses WMI
to manage NT services.
The Windows Script Host
Some of the operations used in these scripts require
that at least version 5.1 of the Windows Script Host (WSH 2) be installed.
The version numbers are a bit confusing. The original WSH
included version 3 of wscript.exe, vbscript.dll, scrrun.dll, etc.
WSH 2 installs version 5.0 or higher of those files. As of this writing
v. 5.6 is available. You may see references to both
WSH2 and WSH5...they're the same thing.
VBScript Programming Information
Software
WEB-ED Webpage and Scripting Editor 5
(Version 5.5 released: 7-15-07)
WEB-ED Webpage and Scripting Editor is a code editor mainly
for VBScript, HTML, DHTML, ASP and CSS. There are extra, specialized functions
for HTML, VBS and CSS. VBScript colorcoding and debugging
also work in HTML files (within SCRIPT or ASP tags).
VBS functions include:
Colorcoding of keywords, variables and comments.
Code auto-completion popup for object methods and properties.
Function parameters popup - shows sub and function parameters as you type for
object methods, VBS methods, declared subs and functions - even when in external files.
Object browser to research available objects.
Configurable context help display for VBS methods.
Auto-case adjustment of variables and keywords.
Optional color printing of code.
Snippet library for code storage.
"Jump to last column" on carriage return for easier code indenting.
Format debugging.
Run scripts from the editor (and run in MS debugger if installed).
Help file includes introduction to VBScript for beginners.
All webpages and scripts on this website were written in the WEB-ED Editor.
Books and Reference
There are few books that cover scripting in the
Windows environment. Two suggestions:
Windows Script Host Programmer's Reference
by Dino Esposito (Wrox Press Ltd.)
This is a thorough-going book for people who have some
familiarity with VBScript. It covers WSH 2, from simple to
advanced, with sample operations. As it deals primarily
with the WSH itself, and not specifically with VBScript,
some examples are in javascript.
Windows Annoyances
by David a. Karp (O'Reilly and Assoc., inc.)
If you are new to script, Windows Annoyances might be
helpful. It is a clear, concise guide to using Windows.
In a word, pithy. It includes introductions to VBScript and DOS batch files,
explaining the basics in a few pages. The presentation is notable in that
it assumes no prior knowledge of programming whatsoever.
VBS Reference and Scripting downloads from Microsoft:
The latest version of the WSH is v. 5.6. There have been no updates
to VBScript or the Scripting Runtime library since version 5.1, but v. 5.6 does
include updates to the scripting host (wscript.exe).
The changes, which seem to be mainly intended for system
administrators, include new functions for remote script running and the ability
to sign scripts for security.
Microsoft seems to often reorganize their website
without providing forwarding links to new URLs. The two links below were
valid as of Septmeber 2003. If they don't work you might try doing a search
for Windows Script Host at Google.
Download page for VBS and WSH documentation:
WSH 5.6 CHM help files
Page with links to download of docs, WSH install files, tools, etc.:
Various WSH downloads
VBScripts
Sampler Pack - samplevbs.zip
This is a zip file containing a dozen VBScripts,
ranging from simple message boxes to multi-
function scripts that can write to the registry,
create textfiles, run programs, make shortcuts, etc.
Download samplevbs.zip (13 KB)
Text Ops - textvbs.zip
These are scripts to demonstrate the use of the Textstream object.
There are 4 scripts included:
Find how many times a given word or phrase occurs in a text file.
Replace instances of given text in a file.
Process an HTML file, yielding a text file version with all tags removed.
A very basic Textstream class block.
Download textvbs.zip (6 KB)
Back to Index
Files and Folders - filfol.zip
This pack has several scripts that deal with file and folder functions.
It contains samples of many of the FileSystemObject functions:
Change attributes of a file.
Remove all attributes, going down 4 folder levels.
(good for removing Read Only when files are copied from CDR)
2 scripts dealing with DateCreated and LastModified properties.
Examples of working with Drive, Folder and File objects.
Get special folder paths.
Download filfol.zip (8 KB)
Back to Index
WScript.Shell - wshell.zip
This zip pack includes 8 scripts dealing with WScript.Shell:
A demonstration of the many functions the Run command can perform.
Getting the paths to Shell "special folders" (Win, System, Startup, etc)
A script that uses 4 different methods to get 17 common folder paths.
A demo of Sendkeys that opens Notepad, writes text and saves the file.
Drag and Drop shortcut-making script.
Simple demo of Popup message function.
A script to manage multiple address books in Outlook Express.
Change the title bar text on OE4.
(Last 2 use RegRead and RegWrite.)
Download wshell.zip (8 KB)
Back to Index
Start Page Maker - spmaker.zip
The Start Page Maker is a VBScript that will automate
the making of a Start Page for Internet Explorer.
It's a 'wizard' that uses message boxes, a BrowseforFolder class and
a color picker class to walk through the creation of a 3-panel Start Page
(or Homepage) with links. The script will also install the new Start Page
as the IE default.
A second included script can be used to quickly add new links to
the custom Start Page while browsing.
Download spmaker.zip (12 KB)
Back to Index
IE-based Progress Bar - iebar.zip
This is a progress bar written as an inline class, or "class block".
The class can be pasted into any script to provide a progress bar derived from an IE window.
There are 2 nicer progress bars available in the component section below, but if you
don't want to use extra components the IE progress bar can serve fairly well.
The download includes 3 script demos and also demonstrates
using properties in classes. Once the class has been pasted at the end of your
script, the progress bar is created as an object and has several properties that can be
set, including icon, caption, back color, number of progress units, etc.
Download iebar.zip (16 KB)
Note: This script may be incompatible with IE7.
See below.
Back to Index
Class Demo - ClassExtExe.zip
This pack includes a VBScript class with explanation and demo scripts. This is a class written
as an external file. The script also demonstrates drag-and-drop script functionality.
The ClsExtExe class includes 2 Registry functions:
1) Give it a file extension and it will return the full path of the default
program for opening that filetype.
2) Give it the name of a registered executable and it will find the full EXE path.
Download ClassExtExe.zip (5 KB)
Back to Index
Get-Let-Class Block - getlet.zip
This set of scripts demonstrates a class block. That is, a class
included into a VBScript that is used as though it were an external object. This class encapsulates text file
operations and shows the use of Get, Let and Err.Raise.
One of the demo. scripts is a Search-and-Replace utility that
uses the class to replace text when a file or folder is dropped on it.
Download getlet.zip (7 KB)
Back to Index
Desktop Pack - deskpack.zip
This is a pack of handy Drag-and-Drop scripts that can be left
on the Desktop. Some of these functions have been included in
other scripts. They're all together here with Drag-and-Drop functionality.
Change file attributes - drop a file on it to change any attributes.
Remove all attributes - drop any folder on it to remove file attributes
(such as Read-Only) down to the 4th folder level.
Character - Ascii translator (not Drag-and-Drop).
RegSvr script - drop a file on it to register or unregister a system file.
Tab remover - Ever copy and paste webpage text, then notice the
pasted text has wide tabs? This will remove them.
Internet Explorer homepage setting script.
URL converter - converts deliberately obscured URLs to readable.
EXE2CAB - converts a self-executing CAB file (EXE) to CAB, using only Textstream.
New
CleanTEMP - Easily delete files from *all* TEMP folders.
New 4-08
DOCtoTXT - Convert DOC files to text. Handy to shrink and simplify all of those
attachments sent by people who don't know how to use Notepad.
New 4-08
Columnizer script - Converts a text file into 2, 3 or 4 columns.
Includes an option to choose how many lines are assigned
to a given column at a time. Demonstrates ReDim for arrays.
One limitation: Columns will only line up when using a monospaced font.
Download deskpack.zip (15 KB)
Back to Index
Shell.Application Ops - shellapp.zip
The Shell.Application object is not very well documented but has
some useful functions. The scripts in this pack demonstrate many
of the Shell.Application methods:
Various ways that BrowseForFolder can be used for selection of files or folders.
Enumerate open folder windows, getting path and coordinates.
Open folders and most of the items on the Start Menu (Run, Find, Shutdown, etc).
Also, put Windows into Suspend mode.
Run any Control Panel Applet if you know the CPL file name.
ALSO: A FileOpen browsing window displayed by using Internet Explorer to do it.
Download shellapp.zip (16 KB)
Back to Index
Windows System Info - sysinfo.zip
There are 4 scripts and a webpage here. All but one uses JSSys3.dll.
Three of these files are usable only on Win9x/ME. You don't have to use JSSys3.dll for
these scripts but you will need a means to read HKEY_DYN_DATA and
HKEY_CURRENT_CONFIG Registry keys. You'll also need a means to
enumerate Registry subkeys.
CPUdata - reports the current CPU usage. (9x/ME only)
Hardware info - compiles a list of installed hardware with information
such as driver date, manufacturer and INF file name. (9x/ME only)
Hardware9X info. webpage - a graphical version.
Display info - gets BPP, screen size, V. refresh rate.
IE Display info - Uses IE to get screen size and BPP info.
WMI Hardware Survey - Details installed hardware on all Windows
versions if WMI is installed.
(New 5-08)
Download sysinfo.zip (11 KB)
Back to Index
Folder Tweaks Galore! (FTG)
Folder Tweaks Galore (FTG) has been replaced. FTG was
a script/HTML utility that provided an easy way to edit the folder.htt
file in Windows. Folder.htt is a webpage that controls the display and functionality
of folder windows. With FTG a number of extra functions and customizations
could be added.
But these days most people are using Windows XP,
and unfortunately, Microsoft removed the "WebView" folder window functionality in
XP. There is no system-wide file folder.htt. Any appearance of WebView in XP
is just a fake veneer. (Pre-XP systems have an actual Internet Explorer browser
window in folders, which displays in accord with folder.htt. There is no browser
window in XP folders.)
That means that very little folder customization is possible in Windows XP.
In order to provide custom folder functions in Windows XP, an Explorer Bar
has replaced FTG. The Explorer Bar, jsFolderView +, is a free plugin that adds
a left-side panel in folder windows. jsFolderView + has 4 "tabs", providing a
number of options. Among them is a browser window tab for which you can write
your own custom webpage. In other words, it's the return of folder.htt for XP!
See the
jsFolderView + page
for more information. There is also a link on that page for the old FTG package, in case anyone
using Windows 95/98/NT4/2000/ME still wants to use FTG.
Back to Index
EZPlanner - Webview Appointment Calendar
EZPlanner is a set of HTT and HTML files that create a small script-based program.
It's set up as a customized webview folder. When the folder is opened, instead
of seeing files you see an HTML-based program that includes and appointment calendar
and an address book. It's a bit hard to describe this.
See the picture
here.
Download ezplan.zip (50 KB)
Back to Index
Two Thumbnail Viewers
Picture Viewer - Thumbnail Generator Script
The Picture Viewer script is a handy thumbnail viewer.
Drop a folder on it or double-click to show a BrowseForFolder window.
An Internet Explorer window will open displaying thumbnails of all BMP, JPG
and GIF files in the selected the folder, along with the image file names. The
layout can be easily customized by changing settings in the script: size of
thumbnails, size of IE window, and number of pictures in a row can all be
changed easily. Other functions: 1)Click any thumbnail file name in the window
to display actual image width and height in the status bar. 2) Press ENTER after
clicking a file name to display that image full size.
This script uses the same functionality that normally displays a single thumbnail
in web view folder windows when a file is selected. (The ThumbCtl object in WebVw.DLL). The script writes a webpage
to display images in the folder, then calls IE to open the page. It then waits
until IE closes and deletes the webpage. Picture Viewer works in any version
of Windows that has Active Desktop. It should also work on Windows XP.
Since the thumbnails display in an IE window this script is also a handy way
to print a large number of pictures. (Set the thumbnail size and number-per-row
as desired, drop a folder on the script, then right-click the thumbnail window
and click Print.)
Download picview.zip (7 KB)
JPG Thumbnail Extractor
The JPG Thumbnail Extractor script is for JPG images taken with a digital
camera. The Picture Viewer script (above) can deal with more image types, but it must
generate each thumbnail from the original image, using the Windows system file webvw.dll.
In a large folder that process can be extremely slow. The JPG Thumbnail Extractor takes
a different approach: Nearly all pictures taken with a digital camera are saved as JPG
files with a thumbnail version stored in the file header. This script extracts those thumbnails,
saves them to a folder, then loads them into a webpage. In other words, this script does
not need to generate thumbnails. It just extracts the "hidden" thumbnails created by
digital cameras when pictures are taken. Like the other script above, this script displays
the thumbnails in an Internet Explorer window using an HTA file. The images can then be
printed by using the (IE) right-click menu. Also, clicking any thumbnail image in the webpage
will display the full size image in the default viewer for JPG files.
Download jthumbs.zip (7 KB)
Back to Index
Class Pack
This is a collection of class blocks for pasting into scripts. As classes they act as creatable,
external objects. The variables and private functions of the class are not visible to the rest of the script,
so no editing of the main script code is necessary. Just paste the class block at the end of the
script to add complex functionality.
Some of these classes are new in this pack. Others have been included
in other packs. Most of these come with two files: a heavily-commented demo script
and a compact, uncommented copy of the class for pasting.
ClsReg Easy functions for reading Registry values: Check for the existence of a key or value,
check the data type of a value, or return formatted data along with datatype. Enumerate keys and
enumerate values by exporting a .REG file. Return 4-byte
binary values as decimal numbers.
ClsINI contains 7 INI file functions.
ClsColors returns 6-character hex values for common system colors.
ClsExt returns path of default program for a given file extension.
ClsColPick uses an IE window to provide a 135-square color picker.
ClsMenu provides a multi-item popup menu, like a standard program menu.
(Requires IEMENU.OCX which comes with Win98/IE4 but is missing from some later OSs.)
ClsBrowse Improved versions of ChooseFile and ChooseFolder browsing windows.
(Replaces ClsFileOpen and ClsFindFol.)
ClsFileOpen uses an IE window to provide a system File Open dialogue; not as crisp
as the ClsBrowse version, which skips the IE window, but allows for graphical customizing and
informational text in the IE interface.
ClsFindFol This is an updated version of the BrowseForFolder scripts in
the ShellApp pack. There's an option to also show files in the browsing window.
The Browse function returns path of selected item and whether it's a file or folder.
If a file was selected this class also makes sure that the file extension is included
in the path (a problem on systems with hidden file extensions). With those extra
functions ClsFindFol can be used as a File Open dialogue, as well as for folder selection.
ClsPaths A compact class that uses a combination of 4 different methods
to return system folder paths - for current user or all users - on all Windows versions.
Download claspak.zip (61 KB)
Back to Index
CWMIReg - WMI Registry Class
The Registry class in the Class Pack download (above) provides a convenient wrapper for
WScript.Shell functions. (RegRead, RegWrite, RegDelete.) But those functions are limited.
WScript.Shell cannot write long binary data or enumerate keys and values. WMI has the
StdRegProv object for full Registry access, but like most of WMI, StdRegProv is awkward and
poorly designed. This class combines the functionality of StdRegProv with the convenience
of WScript.Shell. Finally, it's full Registry access for scripting with simple functions:
Exists, Delete, CreateKey, SetValue, GetValue, EnumKeys, EnumVals. The only disadvantage
is that WMI must be installed and running, but that will not be an issue in most cases.
The download here includes a copy of the CWMIReg class, as well as sample scripts for
all functions and an HTML-based help file. The class can be pasted into your script or
loaded from a separate file using the
ExecuteGlobal function, which is demonstrated
in the sample scripts.
Download wmireg.zip (18 KB)
Back to Index
Recursion Scripts
Several scripts that will search a folder and all subfolders, creating a list
of all files with a given extension, all files modified since a given date, etc.
Download recurse.zip (5 KB)
Back to Index
Enumerate Installed Software
There are two separate things in this package:
1) A script that includes three functions for enumerating installed software
on any Windows version without needing WMI. It lists (1) software installed via Windows Installer,
(2) software listed in the Registry
App Paths key, and (3) software listed in the Registry Uninstall key.
2) A webpage and a script that together constitute a GUI interface
for exploring software installed via the Windows Installer. The script contains
a class that can also be pasted into other scripts. The class structures Windows Installer
information as a COM object that can be created. Given a W.I. Product ID you
can return a "Product" object from the class, the properties of which contain extensive information
about the given installed software product. The Product object exposes properties
such as Company name, installation date, installed features, components, and files, etc.
In other words, by pasting this class into your script you can access extensive,
organized information from Windows Installer without having to deal with the tedious,
convoluted structure of the Windows Installer object model.
A note about WMI, Windows Installer and installed software:
If you use WMI you may be familiar with the Win32_Product object
for enumerating installed software. WMI software listings are derived from the same
Windows Installer system explained above. Both WMI and the class in this script package
are limited in that they can only retrieve information about software that was
installed using Windows Installer, which is usually a fairly small subset of installed
software.
The advantage of this class is that it does not require WMI. It uses plain
VBScript, going directly to the Windows Installer COM object and cutting out the WMI "middleman".
Through MSI.DLL (The Windows Installer COM interface) you can know the files, Registry
settings, and virtually all other relevant details about installed software.
JSSys3.DLL is required for the first item, the 3-function script.
Download listsoft2.zip (16 KB)
Back to Index
Weblog Script
This is a template script for getting hit counts from raw server logs.
The script processes the raw log file, counts hits for as many files as desired,
then writes the info. to a local log file. (Script editing is necessary.)
Download weblog.zip (4 KB)
Back to Index
Explorer Script and Webpage
This is a webpage that displays a functional old-style explorer window
(the type with listboxes for drives, folders and files). It uses 3 SELECT
elements in combination with VBS to do that. The webpage has a button to
open a selected file. There is also a script version that creates a similar page
and functions as a FileOpen dialogue, returning the path of the file selected.
The script is not a very good way to make a FileOpen dialogue but it might
be of interest for the IE scripting.
Download explorer.zip (10 KB)
Back to Index
Startup Manager Utility
This is a full-scale startup manager in the form of a webpage. It requires the
current version of JSSys3.dll (v. 3.03.0216) and is also included with the JSSys3 download.
The Startup Manager webpage checks the Registry, the Startup folder and the WIN.INI file
to compile a list of programs set to run at startup. It also does what all startup managers should,
but usually don't, do: it provides file information needed to identify the executable set to run at
startup. Any item in the list can then be removed.
While the Startup Manager requires JSSys3 for certain operations, much of
the functionality is made possible by the flexibility of the IE DOM.
Download startman.zip (14 KB)
Back to Index
MSI (Windows Installer) Utilities and Code
Windows Installer is a method of software installation, increasingly used by
Microsoft. It packages program installations into an MSI file that contains
a database holding all information about the installation. The idea, apparently, is
to have a single, dependable system of software installation that allows network
administrators to track installations more efficiently. The actuality is a remarkably
abstruse and superfluous complexity that leaves programmers and end-users alike
virtually unable to know or control how software is installed and what files
are included in a given program.
On the bright side, there is a fairly complete, script-accessible MSI automation interface -
the WindowsInstaller.Installer object. Script can access that object to unpack and edit
MSI installer files. Not only that...
Any MSI file can be used as an SQL database.
The MSI scripts now have their own webpage. There is an MSI unpacker utility (webpage program),
an MSI database editor (webpage program), a free MSI-based US zip code database (webpage program),
and a script for customizing installer files.
See the
MSI code page for all of that.
Back to Index
IE MD - Internet Explorer Configuration Utility
The IE MD is a webpage program, comprised of several HTML pages and VBScripts.
It all comes packed with a script-based installer. The IE MD provides access to
numerous settings and information for Internet Explorer.
See the IE MD page.
Note: The IE-MD may not be compatible with IE7. There are no plans to update it.
See below.
Back to Index
VBS Object Browser Utility
This is a webpage-based object browser made using HTML and VBScript.
An object browser can read type library information to show you what
methods and properties are available from an object. This script-based version
works surprisingly well. It processed the entire IE DOM in MSHTML.TLB
in just a few seconds without overloading WSH.
This utility works by taking advantage of the functions available in the Microsoft library
TLBINF32.DLL which installs with Office and Visual Studio. If you don't have
that file installed you'll need to get a copy of it.
There is also a very good help file for TLBINF32.DLL. You should be able
to get it at
this link.
View picture
Download obbro.zip ( 20 KB)
Back to Index
Browser Ad-Blocker Script (Uses the HOSTS file)
The HOSTS file can be used on all operating systems, and with all browsers, to override IP address
resolution in the browser. That means it can be used to block your browser from contacting any number
of specific websites by simply predefining those URLs as being on your computer. This script is a utility that makes it easy to add
URLs to your HOSTS file while browsing, for the purpose of blocking 3rd party
ads and web bugs.
Some people may feel that it is not fair to block ads from websites,
since those ads provide an income to the webmaster.
The HOSTS file cannot be used to block legitimate ads that originate from the website
you are visiting. But it can be used to block 3rd-party ads, from ad-servers, that may be
used surreptitiously to track your behavior and identity online.
More info. and download on the Internet Privacy Tips page.
Back to Index
Binary Operations and Base64 Conversion with Textstream
This is a script class, ClsBin, that uses the Textstream object, combined with various string and
array functions, to carry out binary operations. It is generally thought that VBS does not handle
binary files (except through later versions of ADODB.Stream, which is not universally installed).
Actually, the Textstream can handle binary files just fine. It just needs some special treatment
to deal with "null" characters. In the Windows API, nulls [Chr(0)] are used to mark the end of
strings. As a result, while Textstream has no trouble reading or writing a string that contains nulls, the nulls
cause problems when you try to read text from the string or perform operations on it.
ClsBin provides a set of workarounds that make it possible to read and write file
bytes as both numbers and text, making it possible to perform any typical binary file operation.
Functions in the ClsBin class:
Read and write binary files.
Binary file helper functions, such as converting 4 bytes to a number.
Convert to and from Base64.
Get File Version Info. for PE files
(EXE, DLL, OCX. etc.) This is the info.
that shows on the Version tab of the file's Properties window, such as Description, CompanyName, etc.
A sample demo script uses the class to lighten a bitmap file image.
Download ClsBin package (tsbin.zip) - 52 KB
Notes about working with binary files
The JSBin.DLL component (see below) is an easier, more efficient
way to work with binary files, but the ClsBin class can do it without any extra components.
The JSBin.DLL download may also be of interest for more binary sample scripts if you
download this package.
Also of interest may be the
File Version Information Class and the
Icon Extractor
script (below). Despite the fact that VBScript cannot access the Windows API, all of these scripts demonstrate
ways in which VBS can often be used to bypass those same API functions. The File Version Info. class achieves
what normally requires a call to the API function
GetFileVersionInfo in VERSION.DLL. And the Icon
Extractor does the equivalent of calling the
ExtractIcon function from SHELL32.DLL. Both scripts work
by bypassing the level of the Windows API to operate at a lower level - the basic level of reading, writing
and manipulating bytes.
Note About DBCS (Asian) Languages With Respect to Textstream and Binary Files:
If you work with Asian-language systems there is a limitation that you need to be aware of,
regarding the use of the Textstream object to read and write binary files. DBCS (double byte character set) languages,
such as Chinese, Japanese and Korean, pose an extra challenge. One of the official Microsoft scripting experts, Eric Lippert, has
written about this issue in his "blog".
Unfortunately, if you have read that posting you may be left confused about how and
where Textstream binary operations will work. Mr. Lippert is somewhat forceful in asserting that Textstream
does not really work for binary functionality. But that is simply not true. As a result, his explanation of Textstream limitations is
a bit misleading and generally uninformative. The following explanation is an attempt to clear up any confusion.
The Textstream methods of
CreateTextFile and
OpenTextFile both have an optional
format parameter. If format is not specified then it defaults to ASCII. So Textstream is normally treating
all files as ASCII files, generally representing each byte as a character. If you look at
any file in a hex binary editor you will see the contents represented as a series of numeric byte values, from 0 to 255.
If that file is a plain text file then the bytes represent characters. For
example, in English the byte 84 is "T"
and 116 is "t". The ASCII system uses the "local codepage"
to define the character assignations for bytes. That means that a series of bytes in a text file will be
translated according to the default language on the local system. With most languages, each byte represents a
character and Textstream can be used to handle those bytes as binary data without a problem.
In the case of DBCS
languages, the 256 values possible in a byte are not sufficient to represent all
characters. That problem was dealt with by designating some bytes as escape characters in order to
increase the number of possible characters represented in ASCII text. In other words,
for example, a byte value of 51 might represent a particluar character by itself, but represent a different character
if the 51 is preceded by, say, byte 88. That means that there is not always a one-to-one correspondence between
bytes and characters in DBCS languages.
With European languages this DBCS complication is not relevant.
However, if your computer's default language is set to Chinese, Korean, or Japanese - or if you want to send scripts to
someone with a PC defaulting to one of those languages - then in order to use the ClsBin class you would need to adapt the functions
to account for the escape characters of that language. (Probably you would need to use something like a
Select Case
when translating to/from characters/bytes in order to catch the special escape characters/bytes as the
data is being processed.)
Back to Index
File Version Information Class
This is a class that can be pasted at the end of a script to provide file version information
functionality for PE files (EXE, DLL, OCX). Normally there is no VBScript method to return the information that shows
when a file is right-clicked, then "Properties" is clicked, and the "Version" tab is selected.
This class is condensed from the code in the Textstream Binary Ops scripts (above) to provide
a compact, pastable class that returns
FileVersion,
CompanyName,
FileDescription, etc.
Download ClsProps package (filprops.zip) - 12 KB
Back to Index
The Running Process List
The running process list refers to all programs ("processes") running. That includes programs ("tasks")
that show in the Taskmon window when [CTRL+ALT+DEL] is pressed, and it also includes services.
This package was specifically designed for people who want to check for spyware, viruses, etc.
by investigating the software that is currently running on their computer. Having access to the list of
running processes is useful in guarding against undesirable software on your system because nearly all
such software runs in the background and is therefore in the list of running processes. Since "malware"
is usually set to run all of the time, it can be caught in the act. (But note that kernel rootkit software will not show
up in the process list.)
The download includes a script that details the running processes by using JSSys3.DLL (included). Also included
is an information HTML file that explains how to use the script.
Download ProcLister script (procs.zip) - 73 KB
Back to Index
DOM-Editor: A script-based HTML editor
DOM-Editor is a "What-You-See-Is-What-You-Get" webpage editor made with
VBScript. It uses a webpage with 2 sub-frame pages to create a highly functional HTML editor
powered by VBScript, using only the IE Document Object Model (DOM) to accomplish
all the operations needed.
DOM-Editor is not meant to be a superlative
HTML editor. Rather, the idea is to provide sample code for various
IE DOM methods. The IE DOM is vast and it is difficult to find thorough documentation for it.
This editor provides a way to demonstrate many of the IE DOM methods, and also
serves to demonstrate the remarkable flexibility of the IE DOM.
Included methods: TextRange object operations, Body, Window and Document ops,
getAttribute, setAttribute, showModalDialogue, working with HTML Elements, etc.
View picture
Download DOM-Editor (domedit.zip) - 53 KB
Note: This script may be partially incompatible with IE7.
See below.
Back to Index
Icon Extractor
This is a set of scripts that extract icons from PE files (EXE, DLL, etc.) They're based on the
PE file functions used in the File Version Info. script (above). This script uses only
the Textstream object to read the resource table structure of a PE file and extract
the icon resources listed there. One script will extract icons of 9 different common sizes and
save them as ICO files. (Drop SHELL32.DLL onto this script to see what it can do!
It works surprisingly fast, even with files containing hundredss of icons.)
The 9-08 update adds another script that extracts and reconstitutes
whole compound icon files. In many cases an icon file may contain multiple icons in
different sizes. The updated version script recreates those files. Whether the .ico file
has 1 icon or 10 icons inside, each icon is extracted accordingly as it was stored in the
PE file resources. (By contrast, the original script just extracts all icon images, creates
file headers for them, and then writes them to disk individually.)
Download Icon Extractor (iconex.zip) - 32 KB
Back to Index
Roll-Your-Own StartPage (with download component)
See the
RYO StartPage page for this. It includes
a file download component (ActiveX EXE) and sample script. The whole package is a
script-based RSS news reader that creates a custom start page based on selected RSS links.
The source code for the main body of the component, jsTP.exe, is also available on
the
VB Code page as a VB6 file download UserControl.
Back to Index
Custom Message Box

This is a customizable message box made with Internet Explorer.
If you want something snazzy, see the JSDraw.DLL component, which allows you
to make a "skinned" message box. If you want something simple that mimics a system message box, then you might find
this useful. It is a small VBScript class that can be pasted into a script to provide
a message box object with several custom options. It uses the default system colors in
an Internet Explorer window to produce a close facsimile of a system message box.
This message box is
self-sizing, with an option for using an icon image,
font choice, unlimited number of buttons, etc. It is very easy to use. You just create the
object, add the parts that you want as properties (caption, icon, buttons, etc.), the display the
window.
Update Note Feb-06: A new version of the Custom MsgBox adds options to include a list (listbox or
dropdown selector) and/or text input in message box windows. The download now includes all versions: The original custom message box,
a version of the old message box that can display common XP "skins", and the new, updated message box.
View more custom message box samples.
Download Custom Message Box Class (msgb.zip) - 50 KB
Note: This script is incompatible with IE7.
See below.
Back to Index
XPFix - Various VBS/WMI Utilities for Windows XP
These utilities have their own separate webpage. There are currently two downloads,
which are both HTA webpage programs using VBS and WMI.
One download is
XPFix, a general tweak/fix utility for Windows XP that uses VBS and WMI. The idea
with XPFix is to provide a quick way to fix some
of the problems on a default XP install, and add back some of the useful things that are missing from XP.
XPFix has two HTA windows. One provides an easy interface to disable numerous risky XP services. The other
HTA window provides a handful of simple tweaks to make XP more usable. They include disabling
many of the "babysitting" and nagging functions, as well as adding such handy features as right-click
"Open with Notepad" and right-click "Open in New Window" (for folders).
The second download is
XP Folder Fix. It uses VBS along with the WMI StdRegProv object.
XP Folder fix is an HTA webpage program that enables you to specify exact folder window size
and folder view style for all Explorer folder windows. Ever notice how Windows forgets those preferences?
Selecting folder window size and view preference has never worked properly since Windows 95!
Yet Windows stores the view settings for every folder you have ever opened. XP Folder Fix works
by going through all of those stored settings in the Registry (there are typically settings for several hundred
folders) and repairing the settings so that Windows Explorer will display according to your preference.
Back to Index
Retrieving JPG File Info. - Exif, IPTC, Thumbnail, Summary
JPG files have file header specifications that provide the option to store various
data in the file. This script uses only FSO and Textstream to extract 4 types of
JPG data. The basic code includes 3 classes that present JPG file data through
two custom objects. The total code is only about 20 KB, so it can be pasted whole into
other scripts to add JPG header parsing functionality. (Note that not all JPG files have all types of data stored, and this script can only
retrieve, not save, such data.)
Exif tags - data stored by digital cameras that describes the camera and settings used to take a photo.
Summary properties - Five comment strings that can be saved/viewed on Windows XP in a file's Properties window -> Summary tab.
Thumbnail - a thumbnail copy of the image that most digital cameras store in the file header.
IPTC strings - data such as photographer name, location of shot, etc. that can be saved in JPG files.
Download jpginfo.zip (18 KB)
Back to Index
Sudoku Solver
Would you like to impress a potential employer or lover with your sudoku expertise?
Perhaps a loved one has succumbed to the sudoku craze, convinced it will somehow
make them more intelligent, and you want to thwart them by filling in their entire sudoku puzzle
book "for their own good"? Then Sudoku Solver is what you need. This is an HTA program
that shows a sudoku grid, allows you to enter the pre-existing puzzle numbers, then solves the
puzzle. It may have limited uses, but it's somewhat interesting in terms of the scripting
challenge. It turns out that the code for this is not terribly complex.
Download sudoer.zip (13 KB)
Back to Index
JSDlgBox.dll - Browsing dialogue component
The JSDlgBox component provides browsing dialogue windows for use
in VBScript. The functions are simple with no optional arguments
Browsing windows available: File Open, File Save, Choose Color.
Functions will show the dialogue window and return the file name or
color chosen. (Note: These functions have been added to the JSSys3.dll
component.)
Requires VB6 Runtime Files.
Download jsdlgbox.zip (8 KB)
Back to Index
JSListVw.dll - List box window component
The JSListVw component provides a list box window
and several functions to deal with files and folders.
Functions include getting a list of:
All files in a folder.
All folders in a folder.
All files that were created and/or modified on a given date.
All folders that were created on a given date.
All files with a given file extension.
The list can be added to, cleared, or viewed in a window. List items
can be retrieved as an array or formatted string. An item can be
selected from the window list and the path of that item can be retrieved.
There is a script included that covers all the functions.
Requires VB6 Runtime Files.
Download jslistvw.zip (18 KB)
Back to Index
JSForm.dll - GUI component
The JSForm.dll component provides a variety of interface options.
It provides a scriptable window with options for:
Window Title
Window Caption
Icon
2 textboxes (one of which may be a multi-line box of any size)
Listbox
Browsing dialogues (FileOpen, FileSave, BrowseForFolder, Color Selector)
Buttons - up to 3 buttons with any caption
Audio (play wav files)
Color options - set colors of window, window text and buttons
Save settings - INI file functions
Any or all of these options may be used in a given window.
There are numerous properties that can be set and functions to return
button clicked, textbox text, listbox selected item, etc.
Click Here to see some window samples.
Requires VB6 Runtime Files.
Download jsform.zip (70 KB)
Back to Index
JSSys3.dll - System info. and operations component
The JSSys3 component provides system functions that are difficult to
access or unavailable through VBScript. It contains 2 objects, Ops and IniEdit:
Functions in the JSSys3.Ops object -
Information: Get Current User, computer name, display info., memory usage,
OS version, default program for filetypes, paths of executables.
Registry: Read data from 6 registry keys (all except NT HKEY_PERFORMANCE_DATA),
write data (including long binary), enumerate keys, enumerate values, delete values,
delete keys(including keys on NT that have subkeys).
Given a ProgID or CLSID, check whether a class is registered and, if so, return
CLSID, ProgID, file path.
Display: Get and set system GUI colors. Change wallpaper.
Processes: List running processes, list open windows, get active window,
set active window, close a window/program.
Dialogues: File Open (with multi-select option), File Save and Choose Color
browsing dialogues. (Including optional file extension filter setting.)
Miscellaneous: Shutdown, reboot or logoff. Get and set clipboard text.
Play a WAV file. Print files with default program. Timer(time count, not event.)
PEFile Object: An object available through the Ops object that represents file
property information for PE files (EXE, DLL, etc.) such as version, company,
file description, etc.
Functions in the JSSys3.IniEdit object -
The IniEdit object provides a full selection of operations for reading
from and writing to INI files.
There are 12 demo scripts and a full help file included in the download.
The Startup Manager and Win9x system Info. webpage utilities are also included.
Requires VB6 Runtime Files.
Download jssys3.zip (115 KB)
Back to Index
JSBin.dll - Binary Operations component
JSBin.dll provides binary file functions. They're of limited use in
scripting but if you need access to binary files this should do it.
Functions include:
Write to and read from binary files.
Translate multiple bytes to number and vice versa.
Translate byte numbers to binary strings and vice versa.
Convert between Base64 text and binary.
Sample scripts include bitmap operations, creating an icon from
a bitmap, and getting a list of functions from DLL files (export table).
Requires VB6 Runtime Files.
Download jsbin.zip (35 KB)
Back to Index
JSDraw.dll - Drawing component
JSDraw.dll provides drawing capability to VBScript. This functionality
is in 2 parts:
1) Draw directly onscreen using shapes, text and images.
2) Draw to a built-in window that can be used for custom popup messages.
JSDraw can draw lines, shapes, text and images from files. It can also
be used to save a screen capture of any or all of the Desktop, allowing
drawn graphics to be saved. All of the same methods can also be used
with the popup window and the popup can have up to 4 defined hotspots
to receive input from mouse clicks. In other words, the popup window is
any kind of message box that you want it to be.
View sample drawing
Download jsdraw.zip (56 KB)
Back to Index
JSMail.exe- Email component
Updated 4-08
Send email - plain text or HTML, with or without attachments. Send HTML webpages directly
as HTML email. No email program needed. No dependencies. Compatible with Windows 95/98/2000/ME/XP.
JSMail.exe is a component for sending email. It does not require MS Outlook, MAPI,
CDO or other emailing software. JSMail uses the system
sockets library Wsock32.dll. It sends email by communicating directly with your
outgoing mail server, taking the place of an email program.
JSMail.exe can send plain text or HTML email. With plain text it can also send
attachments. With HTML it can email a webpage with embedded pictures.
Note that this component
still requires an SMTP server. It does not replace the server. It replaces email software.
New in v. 2, April, 2008 update: JSMail v.2 adds the ability to send
to multiple recipients. Also new is an HTA webpage program intended especially for people who
know some HTML and CSS. Do you ever want to design a webpage and then just send that as an
email? The HTML email facilities in common email programs like Thunderbird or Outlook Express are extremely limited,
providing little more than the ability to color text with a few common colors and choose among a few tacky
"stationery" options.
With the SendHTML program, an HTA utility "powered by" JSMail,
you can just write a normal webpage. SendHTML.hta is included in this download. It provides a
handy graphical interface, using JSMail to convert an HTML file to email format and send it. The
SendHTML program will recognize
IMG tags,
BODY BACKGROUND
images, and
images specified in the STYLE
background-image property of a webpage. It embeds the images in your email
so that your webpage is delivered to the recipient just as you designed it.
Using the
SendHTML.hta program is as easy as filling in a few text fields in a webpage. (An HTA program
is an interactive webpage that runs locally in Internet Explorer.) There is also an option
to output the entire email server communication to a text window in the
SendHTML
page. That ability can be useful for troubleshooting.
Download jsmail.zip (71 KB)
Update notes:
1) While the SendHTML.hta utility can send webpages as email directly, some email
programs may not fully recognize your HTML/CSS. Testing might be needed. In our tests, Outlook
Express 5/6 and Apple Mac email rendered HTML emails properly, recognizing and rendering all 3 webpage image types (background
image, inline image, and STYLE-designated background image for elements such as HTML headings), but Thunderbird
did not see a background image assignment in an H2 tag using the CSS
background-image
property. (Outlook Express would also miss the
background-image property if it were applied inline
as an
H2 tag
STYLE attribute, rather than
within a
STYLE tag.)
Thunderbird seems to be somewhat buggy when it comes to properly displaying images in HTML. And ironically,
"webmail" browser-based email, such as gmail or yahoo webmail, seem to be the worst in terms of recognizing
and processing CSS code. So there are some details like that to keep in mind, but in general you
can expect basic webpages sent with JSMail to render as expected for the recipient.
2) Bugfix note: For people with experience using JSMail: Have you used JSMail before? Have you ever experienced WScript
crashing at script end? If so, download this latest version for corrections in the sample script. There is no problem
with the older version of JSMail itself, but the older sample scripts could cause a script crash in some circumstances.
VB6 code option:
VB code is also available for this, in the form of a VB UserControl.
The VB code is essentially the same as the JSMail component, but it can be compiled into VB software to provide
built-in email capability. The VB code does not use any controls, such as the Winsock control.
It is straight VB and sockets API. The UserControl incorporates Base64 encoding for attachments, email formatting, server IP resolution,
etc. In short, it is a compact, soup-to-nuts, emailing engine that can be dropped into any VB project to
provide emailing functionality with no dependencies, on Win95 through XP.
Back to Index
jsrssv.exe- RSS component
jsrssv.exe is a component for downloading and processing
RSS files from web feeds. It has functionality to download files,
write downloaded files to disk, and process files as RSS text,
returning an RSSFile object that provides access to the feed elements
through an RSS object model. jsrssv.exe can be used to download and
custom-format RSS feeds.
This is currently a beta component that has had limited testing.
Feel free to email with questions or reports about your experience using it.
(See the VB code page for an OCX ActiveX control equivalent with source code.)
Download jsrssv.zip (37 KB)
Back to Index
RTFtoText Conversion Component
jsRTF.exe is a simple component that can be used to process RTF text in script. RTF
text is Rich Text Format, the text with formatting information used in WordPad and in
RichTextBox controls. RTF records information about font, text color, text size, etc. in
the text itself. A RichText window, such as WordPad, can load RichText and display
the formatting. (MS Word uses similar functionality.)
jsRTF provides functions that mimic the Textstream object. An RTF file
or string can be loaded as a stream and then read from, or written to disk, as the plain text version.
Download jsrtf.zip (23 KB)
Back to Index
Type Library Reader Component
jsCOM.DLL is a component for reading and documenting type libraries, with a particular
emphasis on information relevant to scripters. jsCOM is similar to the object browser
script above. It is not a replacement for the object browser script but rather a replacement
for the file that script uses, TLBINF32.DLL, which is not installed on all Windows systems and
is very difficult to work with, especially for scripters. TLBINF32.DLL is the component used
to display an object browser in Visual Studio and MS Office. An object browser is
a utility that displays the methods, properties and events in scriptable COM objects.
jsCOM.DLL reads type libraries (the system documentation that makes
COM possible) and then provides a usable object model of
the information found there. You can use it to make your own object browser; to list, for example, the methods of FileSystemObject, find
out what file it derives from, find out whether it's installed locally, check for the existence of
a specific method, retrieve the values of all FSO constants, etc.
Download jscom.zip (36 KB)
Back to Index
JSProgBr.exe - Progress Bar component
This is a simple progress bar component. It's made as an ActiveX EXE
so that the progress bar can run independently of the script. There are
30 units of measure. Draggable title bar. Title and caption can be changed
while running. The window can show an icon. The window can optionally
be shown center screen and/or on top of other windows. Progress can
be set to proceed automatically with a timer (using WScript.Sleep).
Requires VB6 Runtime Files.
Download progbar.zip (13 KB)
Back to Index