How to access a Const declared in Skript form Delphi?

How can I access a Const, which is declared in my Script from Delphi?
Access means, I want to read its value.
I know, a Var can be accessed by GetVarContents, but what about Const?

Greetings Klaus

on the TPSCompiler, use

        function GetConstCount: Longint;
        function GetConst(I: Longint): TPSConstant;

Thank you Carlo,
this gives me just the Consts registered in Delphi, but I need the Consts declared in my Script.
Any additional hints?


read it after compiling the script? It does add them to that same list.

Thank you Carlo,
I already tried this, but after Compiling GetConstCount raises an Error:
This function can only be called from within the OnUses event.

hrmm oke. does it work if you comment that check out? Else isn’t there a 'after compiling" event?

unfortunately, there is no OnAfterCompiling Event
and I tried your suggestions but without success.
FProcs is nil

See Code:
function TPSPascalCompiler.GetProcCount: Longint; begin if FProcs = nil then raise EPSCompilerException.Create(RPS_OnUseEventOnly); Result := FProcs.Count; end;

Seems I have to try to implement an OnAfterCompile Event


        property OnBeforeCleanup: TPSOnNotify read FOnBeforeCleanup write FOnBeforeCleanup;

you made my day.
Thank you for excellent support.

1 Like