Sorry there is no way for the script to execute while it is running.
EDIT: actually if you have a button in your form
below this:
SCAR Code:
Button1 := TButton.Create(frmDesign);
add this:
SCAR Code:
Button1.OnClick := @ButtonClick;
then above the InitForm part add:
SCAR Code:
procedure ButtonClick(sender: TObject);
begin
WriteLn('Hello');
frmDesign.Caption:= frmDesign.Caption + '.';
frmDesign.ModalResult:= mrOk;
end;
that should get the hello to come when you press the button.
try this:
SCAR Code:
program Yakman;
var
frmDesign : TForm;
Button1 : TButton;
procedure ButtonClick(sender: TObject);
begin
WriteLn('Hello');
frmDesign.Caption:= frmDesign.Caption + '.';
frmDesign.ModalResult:= mrOk;
end;
procedure InitForm;
begin
frmDesign := CreateForm;
frmDesign.Left := 250;
frmDesign.Top := 114;
frmDesign.Width := 263;
frmDesign.Height := 180;
frmDesign.Caption := 'Helper';
frmDesign.Color := clBtnFace;
frmDesign.Font.Color := clWindowText;
frmDesign.Font.Height := -11;
frmDesign.Font.Name := 'MS Sans Serif';
frmDesign.Font.Style := [];
frmDesign.Visible := False;
frmDesign.PixelsPerInch := 96;
Button1 := TButton.Create(frmDesign);
Button1.OnClick := @ButtonClick;
Button1.Parent := frmDesign;
Button1.Left := 79;
Button1.Top := 99;
Button1.Width := 75;
Button1.Height := 25;
Button1.Caption := 'Click Me';
Button1.TabOrder := 1;
end;
procedure SafeInitForm;
var
v: TVariantArray;
begin
setarraylength(V, 0);
ThreadSafeCall('InitForm', v);
end;
procedure ShowFormModal;
begin
frmDesign.ShowModal;
end;
procedure SafeShowFormModal;
var v: TVariantArray;
begin setarraylength(V, 0);
ThreadSafeCall('ShowFormModal', v);
end;
begin
SafeInitForm;
SafeShowFormModal;
end.
or if you want the form to continue running remove the:
SCAR Code:
frmDesign.Caption:= frmDesign.Caption + '.';
frmDesign.ModalResult:= mrOk;
from:
SCAR Code:
procedure ButtonClick(sender: TObject);
begin
WriteLn('Hello');
frmDesign.Caption:= frmDesign.Caption + '.';
frmDesign.ModalResult:= mrOk;
end;
hope that helped