Press on the image to return to the main documentation page.
jDotNetBridge
Written by Andrew Graham
This library is a demonstration of how to interface to a C# or VB.NET managed library. You will need to modify and recompile it to match the managed library you want to use. There is more information on this in the document UnmanagedExports.rtf in the library archive.
This particular library shows that it is possible for a B4J Java library to access a Windows COM or ActiveX object using COM Interop via a .NET Framework library. In this case the COM object is the MS Script Control.
This library uses the JNA libraries to call native code methods in a .NET library that have been exported by UnmanagedExports written by Robert Giesecke.
The JNA libraries are licensed under the LGPL, version 2.1 or later, and (from version 4.0 onward) also the Apache Software License, version 2.0
This library is therefore also licensed under those licences.
UnmanagedExports is licensed by Robert Giesecke under the MIT License but as the managed dll modified by its' use contains none of the UnmanagedExports code I believe this license applies only to the actual use of UnmanagedExports. http://opensource.org/licenses/mit-license.php
The DotNetBridge object allows access to the methods of a C# MSScript.dll library that has been processed by the UnmanagedExports NuGGet written by Robert Giesecke to make it callable from a B4J Java library via JNA. https://www.nuget.org/packages/UnmanagedExports
The C# library exposes the Microsoft ActiveX Script Control which can execute JavaScript and VBScript. Here it is initialized for VBScript.
There is very little documentation for the MSScript Control, I obtained that in the xml comments from here. http://msdn.microsoft.com/en-us/library/aa227633(v=vs.60).aspx.
Cause the Script Control to display its' About box.
AddCode (scriptcodeAsString)
Add the provided code to the script of the Script Control.
ClearError
The ClearError method is used to reset the Error object. Using the AddCode, Eval, ExecuteStatement, or Reset methods will also clear the Error object before these methods begin processing.
DotNetLibraryNameAsString
Returns the name of the .NET MSScript library.
DotNetLibraryVersionAsDouble
Returns the version number of the .NET MSScript library.
ErrorColumnAsInt
Returns the source code column number where the error occurred.
ErrorDescriptionAsString
Returns a description of the error.
ErroredAsBoolean
Returns True if an error occurred during script execution. The other ErrorXxxx methods give more information
ErrorLineAsInt
Returns the source code line number where the error occurred
ErrorNumberAsInt
Returns the error number.
ErrorSourceAsString
Returns a description of the general type of error.
ErrorTextAsString
Returns the line of source code where the error occurred.
Eval (expressionAsString) AsString
Evaluate an expression and return the result.
ExceptionFlagAsBoolean
Returns True if an Exception occurred running a script or evaluating an expression.
ExceptionMsgAsString
Returns the message of whatever Exception occurred when running a script or evaluating an expression.
ExecuteStatement (statementAsString)
Execute the single provided VBScript statement.
Initialize
Initialise an instance of our .NET library Interface so we can call its' methods.
Reset
Reinitializes the scripting engine.
ResultTypeAsString
Returns the original type of the result as the actual result is converted to a string value by Eval and Run.
Run (startsubAsString, subparams() AsString) AsString
Run a pre-loaded script by calling the named Sub or Function with the supplied parameters. If a Function was called the return value of that Function is returned.
SetAllowUI (valueAsBoolean)
When set to True, means that the script program can display user interface (UI) elements such as a MsgBox or InputBox.
SetScriptTimeout (valueAsInt)
Sets the maximum amount of time in mS that a script can run before a warning message is displayed (if the AllowUI property is True). -1 = no timeouts will occur. 0 = the ScriptControl will monitor the execution of the script and will trigger the Timeout event if it determines that the script is hung.
SetUseSafeSubset (valueAsBoolean)
When set True prevents access to selected objects and procedures that can compromise an applications' security.