Every time I run this script:
SCAR Code:
program New;
var
frmDesign : TForm;
CheckBox : array [1..7] of TCheckBox;
Button1 : TButton;
PageName, PageURL : TStringArray;
procedure LoadPages;
begin
PageName:= ['Google', 'SRL', 'YouTube', 'RuneScape', 'RuneScape Play', 'Facebook', ''];
PageURL:= ['http://www.google.co.uk/', 'http://www.villavu.com/', 'http://www.youtube.com/?gl=GB&hl=en-GB', 'http://www.runescape.com/title.ws', 'http://www.runescape.com/title.ws', 'http://www.facebook.com/', ''];
end;
procedure OpenPage(Webpage : string);
begin
OpenWebPage(WebPage);
Wait(3000);
end;
procedure Open(sender: TObject);
var
I : Integer;
begin
for I:= 1 to (High(PageName) + 1) do
begin
if CheckBox[I].Checked then
begin
OpenPage(PageURL[(I - 1)]);
Alert('Opened ' + PageName[(I - 1)]);
end;
end;
end;
Procedure InitForm;
var
Colour : TIntegerArray;
R : Integer;
Begin
frmDesign := CreateForm;
frmDesign.Left := 250;
frmDesign.Top := 114;
frmDesign.Width := 220;
frmDesign.Height := 267;
frmDesign.Caption := '† Open Webpages †';
Colour:= [clAqua, clLime, clRed, clBlue, clWhite, clPurple, clMaroon, clGreen, clYellow, clCream, clSkyBlue, clTeal, clFuchsia, clOlive, clNavy, clGray, clSilver];
R:= Random(High(Colour));
frmDesign.Color := Colour[R];
frmDesign.Font.Color := clAqua;
frmDesign.Font.Height := -11;
frmDesign.Font.Name := 'Comic Sans MS';
frmDesign.Font.Style := [];
frmDesign.Visible := False;
frmDesign.PixelsPerInch := 96;
if PageName[0] <> '' then
begin
CheckBox[1] := TCheckBox.Create(frmDesign);
CheckBox[1].Parent := frmDesign;
CheckBox[1].Left := 8;
CheckBox[1].Top := 16;
CheckBox[1].Width := 121;
CheckBox[1].Height := 25;
CheckBox[1].Caption := PageName[0];
CheckBox[1].TabOrder := 8;
end;
if PageName[1] <> '' then
begin
CheckBox[2] := TCheckBox.Create(frmDesign);
CheckBox[2].Parent := frmDesign;
CheckBox[2].Left := 8;
CheckBox[2].Top := 48;
CheckBox[2].Width := 121;
CheckBox[2].Height := 25;
CheckBox[2].Caption := PageName[1];
CheckBox[2].TabOrder := 9;
end;
if PageName[2] <> '' then
begin
CheckBox[3] := TCheckBox.Create(frmDesign);
CheckBox[3].Parent := frmDesign;
CheckBox[3].Left := 8;
CheckBox[3].Top := 80;
CheckBox[3].Width := 121;
CheckBox[3].Height := 25;
CheckBox[3].Caption := PageName[2];
CheckBox[3].TabOrder := 10;
end;
if PageName[3] <> '' then
begin
CheckBox[4] := TCheckBox.Create(frmDesign);
CheckBox[4].Parent := frmDesign;
CheckBox[4].Left := 8;
CheckBox[4].Top := 112;
CheckBox[4].Width := 121;
CheckBox[4].Height := 25;
CheckBox[4].Caption := PageName[3];
CheckBox[4].TabOrder := 11;
end;
if PageName[4] <> '' then
begin
CheckBox[5] := TCheckBox.Create(frmDesign);
CheckBox[5].Parent := frmDesign;
CheckBox[5].Left := 8;
CheckBox[5].Top := 144;
CheckBox[5].Width := 121;
CheckBox[5].Height := 25;
CheckBox[5].Caption := PageName[4];
CheckBox[5].TabOrder := 12;
end;
if PageName[5] <> '' then
begin
CheckBox[6] := TCheckBox.Create(frmDesign);
CheckBox[6].Parent := frmDesign;
CheckBox[6].Left := 8;
CheckBox[6].Top := 176;
CheckBox[6].Width := 121;
CheckBox[6].Height := 25;
CheckBox[6].Caption := PageName[5];
CheckBox[6].TabOrder := 13;
end;
if PageName[6] <> '' then
begin
CheckBox[7] := TCheckBox.Create(frmDesign);
CheckBox[7].Parent := frmDesign;
CheckBox[7].Left := 8;
CheckBox[7].Top := 208;
CheckBox[7].Width := 121;
CheckBox[7].Height := 25;
CheckBox[7].Caption := PageName[6];
CheckBox[7].TabOrder := 14;
end;
Button1 := TButton.Create(frmDesign);
Button1.Parent := frmDesign;
Button1.Left := 144;
Button1.Top := 16;
Button1.Width := 57;
Button1.Height := 217;
Button1.Caption := 'Open!';
Button1.TabOrder := 15;
Button1.OnClick := @Open;
frmDesign.ModalResult := mrOk;
End;
Procedure SafeInitForm;
Var
v: TVariantArray;
Begin
setarraylength(V, 0);
ThreadSafeCall('InitForm', v);
End;
Procedure ShowFormModal;
Begin
frmDesign.ShowModal;
End; //<<-----------------------THIS LINE-------------------------------<-<
Procedure SafeShowFormModal;
Var
v: TVariantArray;
Begin
setarraylength(V, 0);
ThreadSafeCall('ShowFormModal', v);
End;
Begin
Disguise('† Open Webpages †');
LoadPages;
SafeInitForm;
SafeShowFormModal;
End.
I get this in the debug box:
Code:
Successfully compiled (63 ms)
[Runtime Error] : Out Of Range in line 157 in script C:\Documents and Settings\Richard\Desktop\Webpage Opener.scar
And a message box with the same message.
The error is the line pointed out in the script above. Any help would be appreciated.
Thanks,
Richard