Sep 29th, 2009, 11:35 PM
Utility: ScriptDev - Simple WSH IDE [VB6]
This project should be useful as a utility and also as a source of sample code for using the Script Control in VB6 programs. It contains a few other ideas in the source code that might also prove useful: simple location of Special Folder paths, saving program settings, and an enhanced way of using DoEvents(). ScriptDev uses a VB-native form of settings file, not true INI format.
The precompiled binary files were scanned with AVG Free 8.5 and should prove virus-free.
ScriptDev 2.1 is a functional basic WSH VBScript development environment. It incorporates a basic script text editor with Find and Replace operations for VBScript WSH scripts in the .VBS format. ScriptDev supplies a simple implementation of the WScript object allowing many simple scripts to be tested right within the IDE itself. The limitations of this WScript object simulation are described in the ScriptDev Help. ScriptDev can be used to develop and test both WScript and simple CScript scripts.
ScriptDev could be easily modified to support scripts in JScript as well. Adding command line parameter support would make it more practical for CScript development and a more complete WScript object implementation would be a useful enhancement. There is no attempt made at syntax colorization or autocompletion.
While ScriptDev works as a simple IDE, its real purpose is to show how to host the Microsoft Windows Script Control in a VB6 program. The program contains a few rare tricks as well, such as a more sophisticated way of using the VB6 DoEvents() function to allow keyboard input while a script is running.
- Basic WScript object emulation.
- Simulated console I/O via StdIn, StdErr, StdOut.
- Retains IDE settings and last open/save directory.
- Control over Timeout, AllowUI, and SafeMode.
- 4 or 8 character tabstops.
- Find, replace, syntax error highlighting.
- Lightweight (61K plus 110K msscript.ocx).
Enclosed precompiled binary uses registration-free COM, which allows it to be stored on removable media and run without installation on Windows XP or later. Tested on XP SP3, Vista SP2, and Windows 7 RC.
Should be possible to recompile and package ScriptDev for formal installation on Windows 9x, 2000, and later.
Requires Shell32.dll 5.0 or later, Windows Script 5.6 or later.
Unencumbered public domain freeware. May be used by anyone in whole or in part in either source or binary forms. No guarantees or support offered. ScriptDev is made available as-is for use at your own discretion.
Last edited by dilettante; Sep 29th, 2009 at 11:41 PM.
Sep 30th, 2009, 02:00 PM
Update: Version 2.2
Found a glaring bug that slipped through.
Changes Since 2.1:
- Fixed bug in Timeout menu processing.
- Added Line and Col display in status bar while in edit mode.
- Precompiled binary is now larger (compiled to native code).
- Minor optimizations, font changes.
- Added another short sample script.
In response to the PM I got: Using the precompiled version of the program with Windows XP (SP2 or later is probably best), Vista, etc. is a simple matter of copying the contents of the "bin" folder to your hard drive or even a flash drive. The versions of the VB6 runtime components on these systems should be fine for use with this utility. If you put it on your hard drive you might want to make a shortcut to it.
I'll look at the change needed for "Shell integration." Without an installer you'd have to go the "open with" route to set this up though. I'll consider adding this as an option within the program.
As it is now the program stores its INI (settings) next to the EXE unless it detects that it has been installed into "Program Files." In that case it makes an entry in your user profile (LOCALAPPDATA).
Last edited by dilettante; Sep 30th, 2009 at 10:44 PM.
Oct 4th, 2009, 02:06 AM
Re: Utility: ScriptDev - Simple WSH IDE [VB6]
A few more changes:
- Removed internal WScript.Shell implementation.
- Added ability to specify WScript.Version values.
- Better able to interrupt/abort runaway scripts in IDE.
The first is the most important. Using the regular WScript.Shell is more useful for people using this as a utility than it was as an example for those interested in using the source as an example.
The Version change is probably gingerbread. I doubt many script writers ever check the WSH version.
The last one can be useful, but to fully enable it you will want to add WScript.Sleep 0 inside loops you are worried might run away. This allows the use of Ctrl-C to abort such a runaway.
Remember, though ScriptDev is a VBScript IDE you could easily modify it for use as a JScript IDE or even make the script language selectable.
Reposted the program Oct 9 to correct a bug in Ctrl-C detection during WScript.Sleep calls.
Last edited by dilettante; Oct 5th, 2009 at 08:44 AM.
Reason: Reposted attachment
Dec 1st, 2009, 02:53 AM
Re: Utility: ScriptDev - Simple WSH IDE [VB6]
Additional updates and corrections.
- Improved statusbar resizing gripper behavior slightly.
- Corrected small bug where the "WSH version lie" selected in the IDE was not properly updating checkmarks in the menu.
- Reformatted simple online Help text.
- Added ability to change the IDE font to any monospaced screen font installed.
- Corrected handling of "press ESC" input when script terminates.
- If you download script56.chm and install it "next to" ScriptDev.exe it will appear in the Help menu.
- Small fix to "find next" logic when we've wrapped around whole script source.
The former CdlOpenSave.cls was rewritten as CommonDlgs.cls, including a ShowFont() method for selecting fonts in addition to ShowOpen() and ShowSave(). May be useful in other projects for replacing COMDLG32.OCX by direct use of COMMDLG.DLL instead.
The program is larger of course, between compiling for native code and adding features it is now around 108KB. The precompiled reg-free COM version is still included as before, allowing "portable" use from removable read/write media like USB flash drives.
If you download the Scripting Help from Microsoft be sure to "unblock" it afterward as suggested on the download page: Windows Script 5.6 Documentation.
The precompiled binaries are now in a folder named "ScriptDev" instead of "bin" which seemed to cause so much confusion.
Last edited by dilettante; Dec 3rd, 2009 at 02:46 PM.
Reason: Updated to version 2.7
Tags for this Thread
Click Here to Expand Forum to Full Width