SCRIPTDEV - A SAMPLE HOST FOR THE MICROSOFT SCRIPT CONTROL

This is a small demonstration of how a VB 6.0 program can use the Microsoft Script Control to allow user scripts to manipulate and automate the program through exposed objects.  This demo takes the form of a simple IDE and runtime environment.

You might want to include such an "IDE" in your own Script Control programs to allow users to write and manage scripts from within your programs.  This demo IDE is fairly limited, offering little more than Notepad does.  A "real" IDE might offer keyword colorization, command completion, a link to VBScript Help, etc.

ScriptDev provides a default global WScript object, which implements a subset of the real (WSH) WScript object.


NOTES

If you use ScriptDev to develop WSH scripts, the WScript and related objects have limitations (see below).

You may need to "Allow UI" for WScript development and "Allow Unsafe" to create and use many objects.  These are now set as defaults however.


CAUTIONS

WScript.Quit will not work while error handling is in effect, i.e. while ON ERROR RESUME NEXT is active.  This also applies to entry of Ctrl-C during WScript.StdIn.ReadLine() calls.

For safety precede WScript.Quit by ON ERROR GOTO 0, and avoid using ON ERROR RESUME NEXT at the top of a script (and for the entire life of the script).

When script source contains Tabs, each Tab counts as one character when the Script Control reports errors by Line and Column.  However where possible the correct source location of the error should appear properly highlighted.

If the message area of the status bar is too small to display the entire message you can try to mouse over it for the full message in a tooltip.

Using WScript.Sleep 0 within loops that might run away makes it possible to abort them in the IDE using Ctrl-C.


MENUS

    FILE    Load and save scripts, quit program.

    EDIT    Find, replace, select all.

    IDE     Control whether to allow unsafe components, etc.

    RUN     Run scripts.

    TIMEOUT Set script timeout interval.

    HELP    View help topics.


DIFFERENCES FROM WSH OBJECTS

    WSCRIPT implements:

    Arguments (returns empty collection)
    BuildVersion
    CreateObject()
    Echo()
    FullName
    Name
    Path
    Quit
    ScriptFullName
    ScriptName
    Sleep()
    StdIn
    StdErr
    StdOut
    Version

    CreateObject() only uses the 1st parameter.

    WSCRIPT.STDIN implements:

    Column
    Line
    ReadLine(), opening a TextBox for input.

    WSCRIPT.STDERR

    Writes to WScript.StdOut as below.

    WSCRIPT.STDOUT implements:

    WriteBlankLines()
    WriteLine()
    WriteChars(), like .Write() in WSH StdOut.
