Can you pause or stop/abort a running script?

We have custom scripts that can run for a long time and are run in a TTask. They are typically doing something like processing a TDataset. Below is an example of a long operation.....

begin
  // 10 minute script runtime
  while Not(DS.Eof) do
  begin
    DoStuff;
  end;
end.

To minimize the complexity of the script, we would not want the person writing scripts to have to keep checking a GLOBAL variable to see if they should exit early.

Ideally we would have a button in our app that would know the script is running and be able to do something like TatScript.Abort; to stop the script.

Since we do run the script in a Thread, is there any way to abort a script before it completes.

Note that all our scripts are custom and don't use forms.

Thank you for the consideration of this question.

Have you tried to use

Scripter.Halt;

?

Thank you. Once I got the Threads and TatScripter setup correctly, Scripter.Halt worked perfectly....

Thank you.

1 Like

This topic was automatically closed 60 minutes after the last reply. New replies are no longer allowed.