Provided by Ernest Edwards
Extended by Guenter Born
WSHHelper.dll provides a class to assist with debugging WSH scripts without using MsgBox calls within your script. Instead a Print method may be used to instrument a WSH script. The Print methods send the string to a debugger (like SysInternals' Debug Viewer www.sysinternals.com, which is highly recommended). The Enabled properties turns it on and off.
Well, here are the steps to obtain and register the necessary tools for debugging:
Registering the WSHHelper.dll may be done with the file Register.bat. After registering the dll once, the class will be accesseable from WSH scripts. Unregistering may be done using the file Unregister.bat.
Viewing the debug output is rather simple:
The debugger viewer windows will display the debugging output send from the script.
Instrumenting means: add lines to your script that prints messages about script values or whatever else. First of all, you need to create an instance of WSHHelper using CreateObject method.
' for VBScript Dim dbg Set dbg = CreateObject("WSHHelper.DebugOutputString")
//for JScript var dbg = WScript.CreateObject("WSHHelper.DebugOutputString");
After creating the object instance, you may use the Print method:
dbg.Print "this is a string" ' VBScript
dbg.Print ("this is a string"); // JScript
Disabling debugger helper output may be done using the Enabled property:
dbg.Enabled = 0 ' disable output dbg.Enabled = 1 ' enable output
The zip-archive contains a simple VBScript and a JScript sample demonstrating how to use the above methods and properties.
The WSHHelper.dll is copyrighted to Ernest Edwards. It comes AS-IS, without any warranty or support of any kind. Use at your own risk.
2004 - by G. Born