Table of Contents

TatCustomScripter Class

Base class for all TMS Scripter components, providing script compilation, execution, and Delphi interop registration.

Remarks

TatCustomScripter holds a collection of scripts in the Scripts property. Scripts can be added, compiled individually, and executed. For scripts to access Delphi variables, classes, methods, and properties, that information must be registered with the scripter using methods such as DefineMethod, DefineClass, and others. All registered class information is stored in the Classes property collection.

Syntax

Unit: atScript

TatCustomScripter = class(TComponent);

Constructors

Name Description
Create Creates a new scripter component instance and initializes its internal state.

Methods

Name Description
AddComponent Registers the component specified by AComp to be accessible from all scripts. The component will be accessible by its name. Published properties of component will also be automatically available for reading/writing.
AddComponents Registers all components owned by AComp to be accessible from all scripts by their names.
AddConstant Registers a constant value to be accessible from all scripts by the given name.
AddDataModule Registers the data module instance ADataModule to be accessible from all scripts, exposing its owned components as properties.
AddDelphiClass Deprecated. Use DefineClass instead.
AddEnumeration Registers an enumerated type so that all its values are accessible by name from all scripts.
AddForm Registers the form instance AForm to be accessible from all scripts, exposing its owned components as properties.
AddFunction Deprecated. Use DefineMethod instead.
AddLibrary Instantiates and registers the library class ALibraryClass in the scripter.
AddLibraryInstance Registers an already-​instantiated library object in the scripter. Prefer AddLibrary for normal use.
AddObject Registers the object specified by AObject to be accessible from all scripts under the name AName.
AddVariable Overloaded
AddVariable(string, Variant)
AddVariable(string, Extended)
AddVariable(string, Double)
AddVariable(string, string)
AddVariable(string, WideString)
AddVariable(string, Integer)
AddVariable(string, Boolean)
BuildEventHandler​Name Builds a conventional script routine name for an event handler on the given component.
ClassByName Same as Classes.​Class​ByName, please refer to TatClasses reference.
Clear Reinitializes all internal structures, releases memory resources, and clears internal state.
This method is automatically called before any compilation.
Compile Compile the current script. See TatScript.Compile for more details.
DebugExecutionLine Calls DebugExecutionLine for current virtual machine. See TatVirtualMachine.​Debug​Execution​Line.​
DebugRunToLine Calls DebugRunToLine for current virtual machine. See TatVirtualMachine.​Debug​RunTo​Line.​
DebugRunToPoint Calls DebugRunToPoint for current virtual machine. See TatVirtualMachine.​Debug​RunTo​Point.​
DebugRunUntilReturn Calls DebugRunUntilReturn for current virtual machine. See TatVirtualMachine.​Debug​RunUntil​Return.​
DebugStepOver Calls DebugStepOver for current virtual machine. See TatVirtualMachine.​Debug​Step​Over.​
DebugStepOverLine Calls DebugStepOverLine for current virtual machine. See TatVirtualMachine.​Debug​Step​Over​Line.​
DebugToggleBreakLine Calls DebugToggleBreakLine for current virtual machine. See TatVirtualMachine.​Debug​Toggle​Break​Line.​
DebugToggleBreak​Point Calls DebugToggleBreak​Point for current virtual machine. See TatVirtualMachine.​Debug​Toggle​Break​Point.​
DebugTraceInto Calls DebugTraceInto for current virtual machine. See TatVirtualMachine.​Debug​Trace​Into.​
DebugTraceIntoLine Calls DebugTraceIntoLine for current virtual machine. See TatVirtualMachine.​Debug​Trace​Into​Line.​
DeclareEventHandler Inserts an event handler declaration in the script source for the procedure named AProcName.
Returns the line number where code should be written, not the line of the declaration itself.
DefineClass Same as Classes.​Define​Class, please refer to TatClasses reference.
DefineClassByRTTI Registers AClass and its members in the scripter using RTTI.
DefineFormClass Registers the class of AForm in the scripter, exposing all owned components as properties of the form class.
DefineMethod Registers a global method in the scripter, accessible from all scripts without an object prefix.
DefineProp Registers a global property in the scripter, accessible from all scripts without an object prefix.
DefineRecord Register a record structure to be used in Scripter like a class (see TatClasses.​Add​Record) and define constructor/​destructor methods.
DefineRecordByRTTI Registers the record type specified by ATypeInfo in the scripter using RTTI.
EntryPoint Calls EntryPoint for current virtual machine. See TatVirtualMachine.​Entry​Point.​
Execute Executes the current script, compiling it first if necessary.
ExecuteSubroutine Executes a specific routine declared in the current script, compiling it first if necessary.
ExpandDebugInfo Calls ExpandDebugInfo for current script. See TatScript.​Expand​Debug​Info.​
ExpandedDebugInfo Calls ExpandedDebugInfo for current script. See TatScript.​Expanded​Debug​Info.​
FindLibraryByClass Searches for a registered library of the specified class and returns its instance, or nil if not found.
GetArrayIndex Calls GetArrayIndex for current virtual machine. See TatVirtualMachine.​Get​Array​Index.​
GetInfoFromRoutine​Name For internal use only. Do not use this method.
GetInputArg Calls GetInputArg for current virtual machine. See TatVirtualMachine.​Get​Input​Arg.​
GetInputArgAsBoolean Calls GetInputArgAsBoolean for current virtual machine. See TatVirtualMachine.​Get​Input​ArgAs​Boolean.​
GetInputArgAsClass Calls GetInputArgAsClass for current virtual machine. See TatVirtualMachine.​Get​Input​ArgAs​Class.​
GetInputArgAs​Date​Time Calls GetInputArgAs​Date​Time for current virtual machine. See TatVirtualMachine.​Get​Input​ArgAs​Date​Time.​
GetInputArgAsFloat Calls GetInputArgAsFloat for current virtual machine. See TatVirtualMachine.​Get​Input​ArgAs​Float.​
GetInputArgAsInt64 Calls GetInputArgAsInt64 for current virtual machine. See TatVirtualMachine.​Get​Input​ArgAs​Int64
GetInputArgAsInteger Calls GetInputArgAsInteger for current virtual machine. See TatVirtualMachine.​Get​Input​ArgAs​Integer.​
GetInputArgAsString Calls GetInputArgAsString for current virtual machine. See TatVirtualMachine.​Get​Input​ArgAs​String.​
GetInputArgAsUInt64 Calls GetInputArgAsInt64 for current virtual machine. See TatVirtualMachine.​Get​Input​ArgAs​Int64
GetInputArgAs​Wide​String Calls GetInputArgAs​Wide​String for current virtual machine. See TatVirtualMachine.​Get​Input​ArgAs​Wide​String.​
GetRowColFromSource Convert a script source position to a row and column information.
Halt Calls Halt for current virtual machine. See TatVirtualMachine.​Halt.​
InProcessExecute Calls InProcessExecute on the current virtual machine. See TatVirtualMachine.InProcessExecute for details.
InputArgCount Calls InputArgCount for current virtual machine. See TatVirtualMachine.​Input​ArgCount.​
InstructionByLine Calls InstructionByLine for current virtual machine. See TatVirtualMachine.​Instruction​ByLine.​
LoadCodeFromFile Load compiled code from the file specified by AFileName parameter.
LoadCodeFromStream Load compiled code from the stream specified by AStream parameter.
LoadLibrary Loads and registers a library by name, searching Delphi-based libraries, script-based libraries, and file-based libraries.
LoadLibrary2 Workaround for C++ automatic header generation. Calls LoadLibrary internally.
RemoveLibrary​Instance Removes a library instance previously registered with AddLibraryInstance.
RemoveProperty Remove the property specified by the name AName.
ReturnOutputArg Calls ReturnOutputArg for current virtual machine. See TatVirtualMachine.​Return​Output​Arg.​
SaveCodeToFile Save compiled code in the file specified by AFileName parameter.
SaveCodeToStream Save compiled code in the stream specified by AStream parameter.
SetInputArg Calls SetInputArg for current virtual machine. See TatVirtualMachine.​Set​Input​Arg.​
SetInputArgIfByRef Calls SetInputArgIfByRef for current virtual machine. See TatVirtualMachine.​Set​Input​ArgIf​ByRef.​
SilentCompile Compiles the current script without raising an exception on error.
SolveAbsolute​Addressing Calls SolveAbsolute​Addressing for current virtual machine. See TatVirtualMachine.​Solve​Absolute​Addressing.​
SystemLibrary Returns the TatClass object representing the default system library with its built-in methods and constants.
UsesObject Makes the methods and properties of AObject accessible directly from all scripts without an object name prefix.

Properties

Name Description
AllowDLLCalls Indicates whether scripts are allowed to call DLL functions directly using an external declaration.
BreakPoints Provides access to BreakPoints property of current virtual machine. See TatVirtualMachine.​Break​Points for more details.
CallExecHookEvent Enables OnExecHook event. If CallExecHookEvent is true, OnExecHook event is fired, otherwise it's disabled.
CallExecHookEvent is false by default.
Classes Holds the list of all Delphi classes registered in the scripter.
Compiled Provides access to Compiled property of current script. See TatScript.Compiled for more details.
CurrentClass Provides access to CurrentClass property of current virtual machine. See TatVirtualMachine.​Current​Class for more details.
CurrentDebugScript Returns the script object used for debugging purposes, pointing to the original script even when a form instance creates a copy.
CurrentObject Provides access to CurrentObject property of current virtual machine. See TatVirtualMachine.​Current​Object for more details.
CurrentScript Gets or sets the currently selected (or currently executing) script in the Scripts collection.
DefaultInstances Holds the list of default objects whose methods and properties are directly accessible from all scripts.
DeferObjectResolution Indicates whether object method and property resolution is deferred from compile time to runtime.
EventBroker EventBroker property provides access to the TatScripterEvent​Broker object which controls the binding between scripter and Delphi events. See TatScripterEvent​Broker class for more information.
FirstInstruction Provides acess to FirstInstruction property of current script. See TatScript.​First​Instruction for more details.
Halted Provides access to Halted property of current virtual machine. See TatVirtualMachine.​Halted for more details.
LastException​Class​Name Provides access to LastException​Class​Name property of current virtual machine.
See TatVirtualMachine.​Last​Exception​Class​Name for more details.
LastException​Help​Context Provides access to LastException​Help​Context property of current virtual machine.
See TatVirtualMachine.​Last​Exception​Help​Context for more details.
LastExceptionMessage Provides access to LastExceptionMessage property of current virtual machine. See TatVirtualMachine.​Last​Exception​Message for more details.
LibOptions LibOptions property holds a TScripterLibrary​Options object with configuration about how libraries are found and loaded in scripter environment. See TScripterLibrary​Options class for more information.
LoadFormEvents Indicates whether the scripter automatically binds event handlers found in DFM files to matching script routines.
NextInstruction Provides access to NextInstruction property of current virtual machine. See TatVirtualMachine.​Next​Instruction for more details.
OptionExplicit Indicates whether variables must be explicitly declared before use in scripts.
Paused Provides access to Paused property of current virtual machine. See TatVirtualMachine.​Paused for more details.
pcode Deprecated property. Don't use it.
Running Indicates whether any script in the scripter is currently being executed.
SaveCompiledCode Deprecated property. This should be always false.
ScriptBaseObject​Class Gets or sets the base class used when a script-based class is instantiated. Defaults to TScriptBaseObject.
ScriptFormClass Gets or sets the class used to create form instances from script. Defaults to TScriptForm.
ScriptInfo Provides access to ScriptInfo property of current script. See TatScript.​Script​Info for more details.
Scripts Holds the collection of all scripts managed by this scripter component.
ShortBooleanEval Indicates whether boolean expressions use short-circuit evaluation, stopping as soon as the result is known.
SilentCompiled Provides access to SilentCompiled property of current script. See TatScript.​Silent​Compiled for more details.
SourceCode This property provides access to the SourceCode property of current script. See TatScript.​Source​Code for more details.
Compilation is NOT called automatically when changing this property.
Watches Holds the collection of watches used for evaluating expressions during script debugging.

Events

Name Description
OnBeforeExecute OnBeforeExecute is called before a script routine (or main block) is executed. ALabel contains the name of the routine to be executed. If the main block is to be executed, ALabel is an empty string.
OnBreakpointStop OnBreakpointStop event is fired whenever a breakpoint is reached in a script execution, and the execution goes to paused state.
OnCompileError OnCompileError event is fired whenever an error occurs during a script compilation.
OnDebugHook Fired repeatedly while the script execution is paused, allowing the application to update its UI.
OnExecHook OnExecHook event is called during scripter execution. It's a callback event that you can use for performing operations while a script is being executed. For performance reasons, OnExecHook is only called when CallExecHookEvent property is true.
OnPauseChanged OnPauseChanged is fired whenever Paused property value is changed.
OnRunningChanged OnRunningChanged event is fired whenever value of Running property changes.
OnRuntimeError OnRuntimeError event is fired whenever a runtime error occurs during a script execution.
OnSingleDebugHook Fired once whenever the script execution is paused or a debug step action is performed.
OnUnknownElement Fired during script compilation when the compiler encounters an unrecognized identifier.