Make the script click buttons like: "Home" and "End"

Discussion in 'Scar/Simba Help' started by ToastedApple, Jun 21, 2009.

Make the script click buttons like: "Home" and "End"
  1. Unread #1 - Jun 21, 2009 at 12:05 PM
  2. ToastedApple
    Joined:
    Feb 3, 2009
    Posts:
    147
    Referrals:
    1
    Sythe Gold:
    65

    ToastedApple Active Member

    Make the script click buttons like: "Home" and "End"

    Hi. I'm using scar for other things than runescape and right now I really have the need to scroll down a page systematically. Is there a way for me to make my script click the: "PgDn" and "End" buttons on my keyboard?

    Thanks for your help :)
     
  3. Unread #2 - Sep 3, 2009 at 2:54 PM
  4. EduardSale
    Joined:
    Sep 3, 2009
    Posts:
    15
    Referrals:
    0
    Sythe Gold:
    0

    EduardSale Newcomer

    Make the script click buttons like: "Home" and "End"

    well, the VIRTUAL KEY CODE for this button is :
    Code:
    VK_NEXT (0x22)
        PAGE DOWN key
    
    so, what we're gonna do is try to implent the virtual key into scar.
    well, the msdn uses windows api, and HEX, so what i did was used the delphi virtual key codes:
    http://delphi.about.com/od/objectpascalide/l/blvkc.htm

    and wel, 0x22 = 22 lol.
    so the scar codes look like this :
    and scar read's the VK strings so :

    Code:
    program downpage;
    var
    i:integer;
    const
    howlong = 10000; // time in mili seconds so 1 second is 1000;
    begin
    activateclient;
    i := 0;
    repeat
    if (i < howlong)  then
    begin
    KeyDown(VK_NEXT);    // VK_NEXT is the downpage button.
    wait(1000);
    i := i + 1;
    end;
    until(i = howlong)
    end.
    
    would work :):D

    ~Eduard

    wanna learn more? check out my thread
     
  5. Unread #3 - Sep 6, 2009 at 6:13 PM
  6. Hey321
    Joined:
    Jul 30, 2007
    Posts:
    503
    Referrals:
    0
    Sythe Gold:
    0

    Hey321 Forum Addict

    Make the script click buttons like: "Home" and "End"

    You could also do this, and use a procedure with a parameter that allows it to click both, depending on what you need at that particular time. I also added standards to mine, so it's a bit easier to read. Feel free to pm me or post if you need any more help!

    Code:
    program New;
    
    const
      Pagedown = true;
    //True causes the script to fire the procedure PgDnOrEnd(true),
    //which in turn fires the key click page down. False does the
    //same thing, but for the key click end.
    
    Procedure PgDnOrEnd(PgDn : Boolean);
    Begin
      If PgDn = True then
      begin
        KeyDown(VK_Next);
        Wait(50);
        KeyUp(VK_Next);
      end else
      begin
        KeyDown(VK_End);
        Wait(50);
        KeyUp(VK_End);
      end;
    end;
    
    begin
      If PageDown then
        PgDnOrEnd(true)
      else
        PgDnOrEnd(false);
    end.
    ~Sandstorm
     
< SCAR keydown not working for F keys | How to add scripts onto Scar >

Users viewing this thread
1 guest


 
 
Adblock breaks this site