89
Maxwell Script for .NET Plugins
Scripting the Maxwell Plugin
The plugin includes a library, Maxwell.Script.dll, which allows access to the current scene from VBA, VBScript, .Net, and any
other environment which is able to create and query .Net or COM objects.
The library is installed to the .Net Framework Global Assembly Cache when the plugin is installed. A separate copy is also
installed in the plugin's directory located @ [ProgramFiles]\MaxwellDotNET\Maxwell.Script. The library installer installs five
files at this location:
Maxwell.Script.dll: this is the .Net class-library which contains the IScriptObject .Net Interface, which may be
Linked directly in .Net code
Maxwell.Script.tlb: this type library is registered by the installer, to enable the library to be shown in the VBA
'Links' and Visual Studio 'Links/COM' dialogs. It may be used for COM interop, and provides a
definition for the IScriptObject COM interface
Maxwell.Script.xml: provides IntelliSense in the Visual Studio IDE when Maxwell.Script.dll is referenced in a .Net
project
register.bat: calls regasm.exe to register the Maxwell.Script.dll library for use in VBA, etc.
unregister.bat: calls regasm.exe to unregister the Maxwell.Script.dll library
Methodology
The main scripting interface, IScriptObject, is implemented internally by Maxwell.Script.dll in the object ScriptObject.
ScriptObject's constructor is the only public entry-point to the library, as all other objects have no public constructor.
ScriptObject, is a very light-weight object - in fact, it has absolutely no data members, and exists purely as a static event
broadcaster. For this reason, as well as the fact that there may be any number of scenes in existence, it is not appropriate to
keep any global instance - clients should always create a new ScriptObject when one is needed to ensure they are working
with the current scene.
If ScriptObject is just a broadcaster, then there must also be a listener to do the actual work - this is implemented inside the
plugin. If no listener currently exists, then events will not be handled, and values will simply be set to default for their
parameter type. If however there is a listener, it will handle the raised events, getting or setting requested values as
necessary to establish a communication between clients and the current Maxwell scene - which is always hosted by the
event-listener (i.e. the plugin).
Comentários a estes Manuais