Results 1 to 6 of 6

Thread: If Button on Form Is Clicked...?

  1. #1
    Join Date
    Jan 2007
    Location
    Skaville, Jamaica
    Posts
    1,117
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default If Button on Form Is Clicked...?

    I need to know how to make my script so that if the button on my form to start the script (log-in script) is pressed, then it begins. How would I go about doing this?

    If you need more information, just post on here.

    Thanks,
    IEJB

  2. #2
    Join Date
    Feb 2007
    Posts
    215
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    before your form code make a procedure like this: (the modalresult closes the form)
    SCAR Code:
    procedure buttonpressed(sender :TObject);
    begin
     frmDesign.ModalResult := MrOk;
     //do stuff
    end;

    then in the form init put something like
    SCAR Code:
    button.OnClick := @buttonpressed;


    hope that helped if you still can't figure it out just ask me.
    A common mistake people make when trying to design something completely foolproof is to underestimate the ingenuity of complete fools.
    -Douglas Adams

  3. #3
    Join Date
    Jan 2007
    Location
    Skaville, Jamaica
    Posts
    1,117
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    SCAR Code:
    program TestForm;

    {.include SRL/SRL.scar}

    var
       frmDesign : TForm;
      Title : TLabel;
      Username : TLabel;
      Password : TLabel;
      UsernameEdit : TEdit;
      PasswordEdit : TEdit;
      Login : TButton;
     
    ////Form Stuff//////////////////////////
    procedure InitForm;                   //
    begin                                 //
    frmDesign := CreateForm;              //
    frmDesign.Left := 250;                //
    frmDesign.Top := 114;                 //
    frmDesign.Width := 218;               //
    frmDesign.Height := 262;              //
    frmDesign.Caption := 'frmDesign';     //
    frmDesign.Color := clBlack;           //
    frmDesign.Font.Color := clWindowText; //
    frmDesign.Font.Height := -11;         //
    frmDesign.Font.Name := 'MS Sans Serif';//
    frmDesign.Font.Style := [];           //
    frmDesign.Visible := False;            //
    frmDesign.PixelsPerInch := 96;        //
    Title := TLabel.Create(frmDesign);    //
    Title.Parent := frmDesign;            //
    Title.Left := 17;                     //
    Title.Top := 20;                      //
    Title.Width := 178;                   //
    Title.Height := 29;                   //
    Title.Caption := 'IEJB Auto Login';   //
    Title.Font.Color := clWhite;          //
    Title.Font.Height := -24;             //
    Title.Font.Name := 'Georgia';         //
    Title.Font.Style := [fsItalic];       //
    Title.ParentFont := False;            //
    Username := TLabel.Create(frmDesign); //
    Username.Parent := frmDesign;         //
    Username.Left := 6;                   //
    Username.Top := 83;                   //
    Username.Width := 88;                 //
    Username.Height := 23;                //
    Username.Caption := 'Username';       //
    Username.Color := clBlack;            //
    Username.Font.Color := clWhite;       //
    Username.Font.Height := -19;          //
    Username.Font.Name := 'Georgia';      //
    Username.Font.Style := [fsItalic];    //
    Username.ParentColor := False;        //
    Username.ParentFont := False;         //
    Password := TLabel.Create(frmDesign); //
    Password.Parent := frmDesign;         //
    Password.Left := 7;                   //
    Password.Top := 121;                  //
    Password.Width := 85;                 //
    Password.Height := 23;                //
    Password.Caption := 'Password';       //
    Password.Font.Color := clWhite;       //
    Password.Font.Height := -19;          //
    Password.Font.Name := 'Georgia';      //
    Password.Font.Style := [fsItalic];    //
    Password.ParentFont := False;         //
    UsernameEdit := TEdit.Create(frmDesign);//
    UsernameEdit.Parent := frmDesign;     //
    UsernameEdit.Left := 98;              //
    UsernameEdit.Top := 86;               //
    UsernameEdit.Width := 108;            //
    UsernameEdit.Height := 21;            //
    UsernameEdit.Color := clTeal;         //
    UsernameEdit.Font.Color := clWhite;   //
    UsernameEdit.Font.Height := -11;      //
    UsernameEdit.Font.Name := 'MS Sans Serif';//
    UsernameEdit.Font.Style := [];        //
    UsernameEdit.ParentFont := False;     //
    UsernameEdit.TabOrder := 8;           //
    UsernameEdit.Text := 'Username';      //
    PasswordEdit := TEdit.Create(frmDesign);//
    PasswordEdit.Parent := frmDesign;     //
    PasswordEdit.Left := 98;              //
    PasswordEdit.Top := 124;              //
    PasswordEdit.Width := 108;            //
    PasswordEdit.Height := 21;            //
    PasswordEdit.Color := clTeal;         //
    PasswordEdit.Font.Color := clWhite;   //
    PasswordEdit.Font.Height := -11;      //
    PasswordEdit.Font.Name := 'MS Sans Serif';//
    PasswordEdit.Font.Style := [];        //
    PasswordEdit.ParentFont := False;     //
    PasswordEdit.PasswordChar := #1;      //
    PasswordEdit.TabOrder := 9;           //
    PasswordEdit.Text := 'Password';      //
    Login := TButton.Create(frmDesign);   //
    Login.Parent := frmDesign;            //
    Login.OnClick:= @clickbutton;         //
    Login.Left := 72;                     //
    Login.Top := 168;                     //
    Login.Width := 75;                    //
    Login.Height := 25;                   //
    Login.Caption := 'Log-In!';           //
    Login.TabOrder := 10;                 //
    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;                                  //
    ////////////////////////////////////////

    ////Login//////////////////////
    procedure log;
    begin
    MMouse(470,300,2,2);
    FTWait(2000);
    Mouse(470,300,2,2,true);
    FTWait(2000);
    TypeSend(UsernameEdit.Text);
    FTWait(2000);
    MMouse(367,277,2,2);
    FTWait(2000);
    Mouse(367,277,2,2,true);
    FTWait(2000);
    TypeSend(PasswordEdit.Text);
    FTWait(2000);
    MMouse(336,318,2,2);
    FTWait(2000);
    Mouse(336,318,2,2,true);
    end;

    procedure clickbutton (sender: TObject);
    begin
    frmDesign.ModalResult := MrOk;
    log;
    end;

    begin
      ClearDebug;
      SafeInitForm;
      SafeShowFormModal;
      FreeForm(frmDesign);
      ActivateClient;
      Clickbutton;
    end.

    Line 99: [Error] (17760:18): Unknown identifier 'clickbutton' in script C:\Program Files\SCAR 2.03\Scripts\Autologin.scar

    Doesn't make sense...

    SCAR Code:
    Login.OnClick:= @clickbutton;

    There's Line 99 =\

  4. #4
    Join Date
    Jan 2007
    Location
    Skaville, Jamaica
    Posts
    1,117
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Sorry, Double post

  5. #5
    Join Date
    Mar 2007
    Posts
    80
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    yea isnt it annoying how if your topic goes below 3rd place, it's lost in the forums forever???
    sry, im a noob, so i cant really help :|
    http://www.fenjer.com/adnan/SRL/16/20/Merchampion.png
    Merchampion is going to be the ultimate autoing script! It will buy items for your set amount of price; trade people without you having to be there, and once your money is all out; guess what! It's going to sell the item for a different set amount of price! It's merchanting without you having to be there

  6. #6
    Join Date
    Jan 2007
    Location
    Skaville, Jamaica
    Posts
    1,117
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    nevermind, still need help, sorry for being so jumpy. Thank you

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. How to use the Edit Button
    By Torrent of Flame in forum Forum Guides
    Replies: 24
    Last Post: 06-18-2012, 05:34 AM
  2. form with 2 text fields and a button
    By nielskool in forum RS3 Outdated / Broken Scripts
    Replies: 1
    Last Post: 05-13-2007, 03:41 PM
  3. Button pop up.
    By darksid in forum RS3 Outdated / Broken Scripts
    Replies: 5
    Last Post: 11-20-2006, 01:41 PM

Posting Permissions

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