Overview
TMS Scripter is a set of Delphi/C++Builder components that add scripting capabilities to your applications. With TMS Scripter your end-user can write his own scripts using visual tools and then execute the scripts with scripter component. Main components available are:
TatScripter: Non-visual component with cross-language support. Executes scripts in both Pascal and Basic syntax.
TatPascalScripter: Non-visual component that executes scripts written in Pascal syntax.
TatBasicScripter: Non-visual component that executes scripts written in Basic syntax.
TScrMemo: Lightweight syntax highlight memo, that can be used to edit scripts at run-time.
TatScripter, TatPascalScripter, TatBasicScripter and TIDEScripter (in this document, all of these componentes are just called Scripter) descend from TatCustomScripter component, which has common properties and methods for scripting execution. The scripter has the following main features:
- Run-time Pascal and Basic language interpreter;
- Access any Delphi object in script, including properties and methods;
- Supports
try..except
andtry..finally
blocks in script; - Allows reading/writing of Delphi variables and reading constants in script;
- Allows access (reading/writing) script variables from Delphi code;
- You can build (from Delphi code) your own classes, with properties and methods, to be used in script;
- Most of Delphi system procedures (conversion, date, formatting, string-manipulation) are already included (IntToStr, FormatDateTime, Copy, Delete, etc.);
- You can save/load compiled code, so you don't need to recompile source code every time you want to execute it;
- Debugging capabilities (breakpoint, step into, run to cursor, pause, halt, and so on);
- Thread-safe;
- COM (Microsoft Common Object Model) Support;
- DLL functions calls.
In addition to the scripting engine, a full Integrated Development Environment (IDE) is to edit scripts, design forms, debugging, and many other operations with Delphi/Visual Studio look and feel for both creating and running script projects. The following features are present in the IDE:
- Full IDE environment dialog;
- Visual form designer;
- Component palette and palette buttons with Delphi 2007 style;
- Integrated syntax memo with built-in code completion and breakpoint features.
Rebuilding Packages
If for any reason you want to rebuild source code, you should do it using the "Packages Rebuild Tool" utility that is installed. There is an icon for it in the Start Menu.
Just run the utility, select the Delphi versions you want the packages to be rebuilt for, and click "Install".
If you are using Delphi XE and up, you can also rebuild the packages manually by opening the dpk/dproj file in Delphi/Rad Studio IDE.
Do NOT manually recompile packages if you use Delphi 2010 or lower. In this case always use the rebuild tool.
Use in Firemonkey applications
TMS Scripter engine can now be used in Firemonkey applications. You can execute scripts in FM applications even with forms.
But note that several VCL components don't have Firemonkey equivalents yet, especially the visual ones, so the scripter IDE (form designer, syntax memo, object inspector, etc.) are not available for Firemonkey applications.
All you need to do in your Firemonkey application is add unit
FMX.ScripterInit
to your project or the uses clause of any unit. Then
you can use the scripter component normally just as you would do with in
VCL (see chapter Working with Scripter).
There are several demos in TMS Scripter distributing showing how to use it with Firemonkey application, including manual debugging.
In this section:
Integrated Development Environment
The ready-to-use IDE for writing scripts and designing forms, available for VCL applications.
Language Features
Topics about supported languages, features, syntax, constructors, etc.
Pascal syntax
Basic syntax
Calling DLL functions
Working with scripter
Using scripter component in your application: how to run, debug, access Delphi objects and other tasks.
The syntax highlighting memo
Using the TAdvMemo control that provides syntax highlighting for Pascal and Basic scripts.
C++Builder Examples
C++Builder examples equivalent to every Delphi example in this guide.