use tatscripter from dll for IDE


We have our implementation of our TatScripter running in a dll and it works.
Now we noticed that sometimes we don't get enough feedback from it when we run a script and it fails. That's why we want to use an additional form that has debugging functions, but only for our advanced users. We now have our own form to write the script that use our own syntax highlighting (we have implemented some additional features to pascal to use other scripts without having to search for them in all our scripts but just do a search in our database).
In our current implementation we have no debugging.
What we want to try:
use an additional button on our screen to open your IDE with debugging features, but we want to put the code in that IDE form in at runtime based on all the scripts needed for our main script and use our own TatScripter from our dll because it already has the needed libraries...
Is this possible?

Thanks in advance!



I managed to change our dll so that it uses TIDEScripter instead of TatScripter and I implemented a function 'dcc_Debugcmd' which would open your IDE so I can debug a script using our initialized scripter.

Now I use this code to run our script using our scripter:

ADialog := TIDEDialog.Create(nil);
AEngine := TIDEEngine.Create(nil);
ADialog.Engine := AEngine;
AEngine.Scripter := dcc_Scripter;
AUnit := AEngine.NewUnit(slPascal);
AUnit.Script.SourceCode.Text := sCmdText + Hrt + Hrt + 'Result := ' + Cmd + ';';

Now I have just two more questions:
1: can I programmatically put a breakpoint on the last line of the sourcecode?
2: how can I use the result of the IDE? I want to run the script in the IDE, but use the result of that script in the same way I used before in our 'dcc_RunCmd' function where our RunResult was defined with this code:

RunResult := dcc_Scripter.ExecuteSubroutine(String(MethodName), aArgs);

Hello Bart,

1. Yes, you can use Breaks property:

2. Unfortunately not from IDE. The IDE can run the same script multiple times, and it doesn't have programatically integration with script results. 

Hi Wagner,

Thanks for the quick response.
How can we programmatically add a default watcher to each script? We want to add a default watcher for 'Result' to all our script when we use the debugger.

You can use this code:

  IDEScripter1.Watches.Add.Expression := 'Result';

Thanks! That did the trick :)