A WSH IDE to execute and debug scripts

You can use the Start menu's Run dialog or you can create a shortcut file to launch a WSH script with optional arguments or with debug options (//D or //X). But this isn't the most sophisticated solution. Would it not be smarter to enter options in a simple dialog and launch a selected script file? Have a look at the Figure below. This figure shows an IDE I wrote to simplify script testing.

All options and arguments contained in the Script Options text box are submitted to the script. This enables you to launch a script with parameters (like file names) and add also WSH options (like a //job:xxx switch).

To select a file, you can use the Browse button. This button opens a File select dialog box. Or you can click a file in the file list, press F2, press Ctrl+C, klick the File textbox and press Ctrl+C. This pasts a file name into the File text box.

After selecting a script file, it can be executed using the Run button. The IDE uses the debug and wsh options selected in the right window column and also the script options found in Script Options text box.

The options in the right column of the application window allows you to choose the host (WScript or CScript) and the Debug option. Debugger options are used only, if the Debug check box is checked.

The Edit button opens the selected WSH script file in Notepad for further editing. View shows the script's source code with line numbers. Both buttons comes in handy during debugging, to identify and modify lines reported in error dialogs.

The IDE is implemented as an HTA application, so it need Internet Explorer 5.x already installed. Just double-click the HTA file to execute the application. I haven't used a HTML file, because the script code causes IE to show an unsave ActiveX warning. If you still use IE 4, simply rename the HTA file to the extension .htm. If the ActiveX warning is shown, confirm it with the Yes button.

I wrote this HTA application as Freeware in the hope that it may be helpful for scripters. The module comes AS-IS WITHOUT ANY WARRANTY OF ANY KIND. In no way will the author be libable for consequences resulting from the use of this module. Use it at your own risk. The module may be used and distributed freely as long as the files remains intact.

Download ZIP file (52 KB)

Further details about the scripting techniques used here may be found in the Microsoft Press title Microsoft Windows Script Host 2.0 Developer's Guide and in the upcoming Microsoft Press title Advanced Development with Microsoft Windows Script Host 2.0. There is also a second solution for Windows 2000 developed by Ian Morrish. The file www.windows-script.com/download/wshwebv.exe contains a htt file to customize a folder in Windows explorer.

Back


by Günter Born www.borncity.de