logo WinWrap®

Upgrade Microsoft ScriptControl to WinWrap® Basic

WinWrap® Basic is an embedded macro language component available for .NET and COM 32 bit and 64 bit Windows applications. The WinWrap® Basic OCX Control is compatible with Visual Basic Scripting OCX Control msscript.ocx.

The WinWrap® Basic Scripting Engine provides both end-users and developers with a complete VB Script compatibility solution.

WinWrap® Basic WWB-COM Scripting Language VBScript Compatibility

  • Microsoft ScriptControl alternative
  • Support for VB Script style scripts
  • Fully compatible support for VBS legacy scripts
  • Access to the ActiveX Host Application via COM
  • Access to the .NET Host Application via COM interop

Microsoft ScriptControl and WinWrap Basic

Microsoft ScriptControl msscript.ocx to WinWrap® Basic Equivalents

Property Description COM - WinWrap® Basic .NET - WinWrap® Basic
AllowUI Sets or returns a Boolean value indicating whether a running script, or the ScriptControl itself, can display user-interface elements. For example, in Microsoft ScriptControl if AllowUI is False, the MsgBox statement will not work. IgnoreDialogs IgnoreDialogs
CodeObject Returns an object that is used to call public members of a specified module ModuleInstance ModuleInstance
Column Returns the column indicating the approximate place in the scripting code where an error occurred. ErrorOffset Error.Offset
Description Returns a short descriptive error message. ErrorText Error.Text
HasReturnValue Returns True if a procedure has a return value; False if it does not. TINFO232 utility dll provided with WinWrap Basic creates an object mode for any COM object Reflection
Language Tells the Script Control to use the specified language. The default is VBScript but it can be JScript. WWB.COM (VBScript, VB6, and VBA compatible) WWB-NET (VB.NET compatible)
Line Returns the line indicating the place in scripting code where an error occurred. ErrorLine Error.Line
NumArgs Returns the number of arguments required by a procedure. TINFO232 utility dll provided with WinWrap Basic creates an object mode for any COM object Reflection
Number Returns a numeric value specifying a run-time error. ErrorNumber Error.Number
Source Returns a string specifying the type of error that occurred. ErrorSource Error.Source
State Set to "Connected" immediately after an AddObject call to to turn on event handling so your script can respond to events in your application. See the code. Pause Pause
Text Returns a string containing a snippet of the scripting code surrounding the location where an error occurred in code. Code Code
TimeOut Sets or returns the time, in milliseconds, after which a user is presented with the option to discontinue scripting code execution or allow it to continue. If value is specified using the NoTimeout constant (-1), no timeout is used. When value is 0, the Timeout event occurs as soon as it is determined that a running script is hung for any reason. DoEvents DoEvents WinWrap Basic calls DoEvents as the script executes eliminating the need for a timeout in most cases.
UseSafeSubset Sets or returns a Boolean value indicating whether the host application is concerned about safety. The objects and procedures that can't be used when UseSafeSubset is True are identical to those restricted by the browser's highest security setting. BlockedKeywords BlockedKeywords

Method Description COM - WinWrap® Basic .NET - WinWrap® Basic
AddCode Adds the specified code to a module. LoadModule LoadModule
AddObject Makes run-time functionality available to a scripting engine. The AddObject method enables a ScriptControl user to provide a set of name/object pairs to the scripting code. AddExtension AddExtensionObject
Clear Clears all Error object properties. The properties of the Error object are also cleared when Reset, AddCode, Eval, or ExecuteStatement methods are executed. Not needed. Not needed. WinWrap Basic manages the Error properties automatically.
Eval Evaluates an expression and returns the result. The context of the Eval method is determined by the object argument. If object is a module, the context is restricted to the named module. If object is the ScriptControl, the context is global. EvaluateVariant EvaluateVariant
ExecuteStatement Executes a specified statement. The context of the ExecuteStatement method is determined by the object argument. If object is a module, the context is restricted to the named module. If object is the ScriptControl, the context is global. Evaluate("Call ...") Evaluate("Call ...")
Reset Discards all scripting code and objects that have been added to the ScriptControl. RemoveExtensions RemoveExtensions
Run Runs a specified procedure. Handler Object Handler Object

Event Description COM - WinWrap® Basic .NET - WinWrap® Basic
Error Occurs in response to a run-time error. ErrorAlert ErrorAlert
TimeOut Occurs when the time specified in the Timeout property has elapsed, and a user has selected End from the resulting dialog box. DoEvents DoEvents WinWrap Basic calls DoEvents 10 times per second while a script is executing. This allows the host application UI to be responsive.

WWB.NET Script Example - Generic Collections

This script uses the .NET Framework generic collection Stack type to hold unprocessed directories and the generic collection List type to hold found file paths.

'#Language "WWB.NET" Imports System.Collections.Generic Imports System.IO Sub Main Dim Files As New List(Of String) Files = FilesRecursive("c: mp") For Each File As String In Files Debug.Print File Next Stop End Sub Function FilesRecursive(ByVal topdir As String) As List(Of String) Dim data As New List(Of String) Dim stk As New Stack(Of String) stk.Push(topdir) Do While (stk.Count > 0) Dim d As String = stk.Pop data.AddRange(Directory.GetFiles(d, "*.*")) For Each dname As String In Directory.GetDirectories(d) stk.Push(dname) Next Loop Return data End Function

WWB.NET Script Example - FolderBrowserDialog

This script uses the .NET Framework Windows Dialog to request a folder input from the user. To use the .NET Framework Dialogs, just create a reference through the WinWrap® Basic editor to the System.Windows.Forms assembly. Then instantiate and access any of the Windows Dialogs.

'#Language "WWB.NET" Sub Main Debug.Print GetFolder Stop End Sub ' From Edit.References create a reference to System.Windows.Forms Function GetFolder As String Using d As New System.Windows.Forms.FolderBrowserDialog d.ShowDialog Return d.SelectedPath End Using End Function

VBScript and WinWrap® Basic Feature Comparison

  • VBScript does not have 64 bit support
  • VBScript does not use .NET assemblies
  • VBScript does not provide an Integrated End-User Scripting IDE
  • VBScript has been moved to Microsoft Sustaining Engineering
FeatureVBScriptWinWrap® Basic
Modeled on Visual BasicSubset of VB6Superset of VB6
Uses the Component Object ModelYesYes
Development StatusMoved to Microsoft Sustaining EngineeringUnder active development by Polar Engineering
64 Bit SupportMust compile host as a 32bit appFull 64-bit support
.NET SupportVBScript has not been adapted to .NETVB.NET compatible (WWB.NET) scripting option available
Integraded Development Environment (IDE)NoFull developement IDE with script editing, autocompletion, and debug capabilities
End-User IDENoScripting IDE can be shipped with application
Uses .NET assembliesCannot access .NET assembliesFull access to .NET assemblies
Encryption3rd party obfuscators availableEncryption/Decryption option available
AutocompletionNoBuiltin documentation via IDE script editor object/method autocompletion capability
DebuggingNoFull debugging capability
EditorNoIDE includes script editor with autocompletion and script debugging
Windows 8 SupportUnknownPlanned support
Compile CapabilityNoCompile option available
Remote DebuggingNoRemote control and debugging

Copyright Polar Engineering, Inc.