Adrian De Armas
Adrian De Armas

Reputation: 101

DWS insert variable values on debug

I'm facing a problem I can't find the workaround... I have a script which take some parameter data before execution. When I run it my code looks like:

Exec := FProgram.CreateNewExecution;
Exec.BeginProgram;

Exec.Info.ValueAsString['varName'] := 'varValue';

Exec.RunProgram(0);
Exec.EndProgram;

It runs just fine. But if I want to debug the script I do something like this:

Exec := FProgram.CreateNewExecution;
Exec.BeginProgram;
Exec.Info.ValueAsString['varName'] := 'varValue';

Debugger.BeginDebug(Exec);
Debugger.EndDebug;

Being Debugger a TdwsDebugger class, I get "runtime error: script is already running". If I don't assign variables values before debugging everything is ok.

Any hints?

Upvotes: 1

Views: 169

Answers (1)

Adrian De Armas
Adrian De Armas

Reputation: 101

I managed to solve it using the TDelphiWebScript component events. Using OnExecutionStarted does not work either. I modified the code and added OnAfterExecutionStarted event, then I added the variables on the new event and everything is ok now.

Upvotes: 1

Related Questions