Extend the WinWrap® Basic Scripting Language with Implements
WinWrap® Basic is an embedded macro language component available for .NET and COM 32/64 bit Windows applications. The WinWrap® Basic Component is an alternative to Visual Basic for Applications (VBA), ActiveX (e.g. VBScript, JScript, PerlScript, Rexx-based WSH engines and others), and VSTA for this purpose. The WinWrap® Basic Component is compatible with VBA, Sax Basic, VB.NET and Visual Basic 6.0 style scripts.
Create a Scriptable Application using Implements
- Call interface methods using normal .NET syntax
- Implement interface methods with script code
- Enforce script interface during parsing
- Automatic interface prototypes generated by the IDE
Scriptable Architecture with Implements
You or your customer can write script code that executes when method calls are
made by the application.
Scripts are validated for syntactic correctness and all the application has to do
is call an interface method.
This is a great way to script, with the application calling your script code at the appropriate time.
Create an Instance of Script Class
The application parses the script
and creates an instance
gets an interface reference (Cast)
and calls the script method.
using (var module = basicNoUIObj.ModuleInstance(ScriptPath(Script), false))
if (module == null)
// script parsing error
using (var instance = basicNoUIObj.CreateInstance(ScriptPath(Script) + ">IncidentAction"))
// Execute script code via an interface
IIncidentAction action = instance.Cast<iincidentaction>();
// script execution terminated, ignore error
catch (Exception ex)
// script caused an exception
Call Script Methods using Normal .NET Syntax
The expression action.Started(this) calls the script code.
[Scriptable] public class Incident
public void Start(IIncidentAction action, string firedby)
FiredBy = firedby;
Interface Provides the Bridge Between the Application and the Script
The application defines the IIncidentAction interface and its methods.
[Scriptable] public interface IIncidentAction
[Scriptable] void Started(Incident incident);
Implement Custom Behavior as Script Methods
A script class module implements the IIncidentAction interface and its methods.
Public Class IncidentAction
Public Sub Started(ByVal incident As Incident) Implements IIncidentAction.Started
incident.FilledInBy = ScriptName()
The WinWrap® Basic IDE facilitates writing the methods for an implemented
Pressing "Enter" at the end of the Implements line writes all the
needed interface prototypes:
Conclusion: Scripts are Clear, Concise and Strongly Typed
WinWrap® Basic provides a comprehensive solution to adding scripting to your application.
Calling script code with an interface and Implements is an alternative to
calling script code through events. Both this solution and the Extend the WinWrap® Basic Scripting Language solution
present roughly equivalent techniques for calling script code. It may be a
matter of style which technique you use.
See WinWrap Examples for instructions on how to download and run "Example 5 - Implements".
Copyright Polar Engineering, Inc.