Access a variable inside of the script
Why when I try to access a variable inside of the script, I give a mistake saying that the variable already exists?
This example is very simple.
I only want to write a text and the script will show it.
Below is my example:
My error:
"Identified redeclared: sText"
=======================================
My script code:
var
sText: String;
begin
ShowMessage(sText);
end.
=======================================
My Delphi code:
procedure TForm1.Button1Click(Sender: TObject);
begin
Script.Clear;
Script.Variables:=Edit1.Text;
Script.Parent := fsGlobalUnit;
if Script.Compile then
Script.Execute
else
ShowMessage(Script.ErrorMsg);
end;
This example is very simple.
I only want to write a text and the script will show it.
Below is my example:
My error:
"Identified redeclared: sText"
=======================================
My script code:
var
sText: String;
begin
ShowMessage(sText);
end.
=======================================
My Delphi code:
procedure TForm1.Button1Click(Sender: TObject);
begin
Script.Clear;
Script.Variables:=Edit1.Text;
Script.Parent := fsGlobalUnit;
if Script.Compile then
Script.Execute
else
ShowMessage(Script.ErrorMsg);
end;
Comments