Introduction

Top  Next

Scripting

 

LMD-ScriptPack allows execution of user-written scripts within Delphi and C++ Builder applications using Microsoft Active Scripting technology. Such scripts can:

 

be written in natively implemented languages: PasScript and NativeVb (see Supported Languages);
be written in various popular scripting languages, including VBScript, JScript, Python etc. (see Supported Languages);
access and use procedures, variables and types defined in the host Delphi application;
access OLE Automation servers e.g.MS Word or MS Excel;
make script variables and procedures available for the host application;
provide script procedures as event handlers for components in the host application.

 

In other words, application users can create scripts in language of their choice and use them flexibly within the application; nearly the whole VCL can be made accessible to such scripts. The developers of advanced applications can implement they own object models (like the MS Word or MS Excel has), and made it accessible from the script allowing end-users scripts to interoperate with the application. Generally, scripts in application can be used for:

 

automating routine user tasks;
extending functionality of the application;
customizing the application to user preferences.

 

Embedding of scripts created by user in runtime into application turns the application into a full-featured Windows scripting host, WSH,  (much like MS Office applications or MS Internet Explorer), making in highly customizable and extensible.

 

Debugging

 

The script execution component provides also functionality for debugging of scripts. Using breakpoints, pausing script execution, stepping (step-over and step-into) are supported. Access to call-stack, local variables, evaluating expressions is also provided. LMD-ScriptPack itself provide debugging features as API, allowing application developers to implement debugger related GUI specifically as required by application.

However, look also at LMD-IDETools package; it contains simple to use debugging related controls, such as local vars view, call stack view, breakpoint list, ect. These controls can be integrated very easily with LMD-ScriptPack debugger.

 

Supported Languages

 

LMD-ScriptPack is supports natively implemented PasScript and NativeVb languages as well as languages, implemented using Microsoft Active Scripting technology.

 

Natively implemented PasScript and NativeVb languages included as a part of LMD-ScriptPack. They are implemented 100% in Delphi with full source code provided. These languages compiles directly into application exe, no external dll is required to deploy with the application. Read more interesting facts about native languages here.
Using shared speed optimized byte-code virtual machine (VM) and optimizing compilers provide great script code execution performance for native scripting languages.

 

MS Active Scripting technology comprises a set of COM interfaces that have to be implemented by a scripting language developers to allow execution of scripts in this language.  Therefore potentially scripts can be executed in any language for each an Active Scripting engine exists (and is installed on your computer). However, there are some language-specific issues which to some extent limit the range of available languages.Currently, LMD-ScriptPack supports the following scripting languages:

 

PasScript (native)
NativeVb (native)
JScript;
VBScript;
Rexx;
Perl;
TCL;
Python;
Lua.

 

PasScript and NativeVB - are parts of the LMD-ScriptPack. JScript and VBScript ActiveScripting engines are shipped with MS Windows, so there's no need to install them separately.

To use any other scripting language you have to obtain and install appropriate engine which supports MS Active Scripting technology. Please refer to the documentation from language provider for more information about installation and usage.