Results 1 to 4 of 4

Thread: Could not call proc...

  1. #1
    Join Date
    May 2007
    Location
    England
    Posts
    4,140
    Mentioned
    11 Post(s)
    Quoted
    266 Post(s)

    Default Could not call proc...

    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
    <3

    Quote Originally Posted by Eminem
    I don't care if you're black, white, straight, bisexual, gay, lesbian, short, tall, fat, skinny, rich or poor. If you're nice to me, I'll be nice to you. Simple as that.

  2. #2
    Join Date
    Apr 2007
    Location
    The Netherlands
    Posts
    5,553
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    I've had problems with it too, but do you actually use it? if not comment it.
    ~Hermen

  3. #3
    Join Date
    Nov 2007
    Location
    Chile
    Posts
    1,901
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Change the Open procedure to:
    scar Code:
    procedure Open(sender: TObject);
    var
      I : Integer;

    begin
      for I:= 1 to 7 do
      begin
        if (PageName[I - 1] <> '') then
          If (CheckBox[I].Checked) Then
          begin
            OpenPage(PageURL[(I - 1)]);
            Alert('Opened ' + PageName[(I - 1)]);
          end;
        end;
      frmDesign.ModalResult := mrOk;
    end;
    It may be caused because you check for a checkbox that is not created. And remove frmDesign.ModalResult := mrOk from InitForm. You have to close when the button is clicked. And for the color just use R := Random(ClWhite + 1). Gl


  4. #4
    Join Date
    May 2007
    Location
    England
    Posts
    4,140
    Mentioned
    11 Post(s)
    Quoted
    266 Post(s)

    Default

    Woot! Thanks Cazax. It works great now. Rep+

    Richard.

    EDIT: Herman, what do you mean?
    <3

    Quote Originally Posted by Eminem
    I don't care if you're black, white, straight, bisexual, gay, lesbian, short, tall, fat, skinny, rich or poor. If you're nice to me, I'll be nice to you. Simple as that.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •