Results 1 to 23 of 23

Thread: TypeSendEx

  1. #1
    Join Date
    Aug 2007
    Location
    in a random little world
    Posts
    5,778
    Mentioned
    0 Post(s)
    Quoted
    7 Post(s)

    Default TypeSendEx

    this is shorter and from what i can see it should still work just as well
    SCAR Code:
    {*******************************************************************************
    procedure TypeSendEx(Text: string; PressEnter: Boolean);
    By: Shuttleu
    Description: Sends human like text.
    *******************************************************************************}

    procedure TypeSendEx(Text: string; PressEnter: Boolean);
    var
      I: Integer;
      Char: Byte;
      ThisOne, NextOne, LastOne: Boolean;
    begin
      for I:=1 to Length(Text) do
      begin
        ThisOne:= (Uppercase(Text[I]) = Text[I]);
        if (not(I = Length(Text))) then
          NextOne:= (Uppercase(Text[I+1]) = Text[I+1]);
        if (not(I = 1)) then
          LastOne:= (Uppercase(Text[I-1]) = Text[I-1]);
        Char := GetKeyCode(Text[i]);
        if ((not(LastOne)) and (ThisOne)) then
        begin
          KeyDown(VK_SHIFT);
          Wait(40 + Random(40));
        end;
        TypeByte(Char);
        Wait(40 + Random(40));
        if (not(NextOne))or(I = Length(Text)) then
        begin
          KeyUp(VK_SHIFT);
          Wait(40 + Random(40));
        end;
      end;
      if (not(PressEnter)) then Exit;
      Char := GetKeyCode(Chr(13));
      TypeByte(Char);
    end;

    ~shut

    EDIT: also while looking through the current TypeSendEx it doesnt wait between typing capitals
    Last edited by Shuttleu; 06-25-2009 at 03:40 PM.

  2. #2
    Join Date
    Jan 2007
    Location
    Nomming bits in your RAM
    Posts
    385
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Good idea. I support it.
    Current Project: Catching up. XD. Potentially back for the summer, depending on how things go.

  3. #3
    Join Date
    Mar 2007
    Location
    <3
    Posts
    2,683
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Note: Not fair to call the whole function yours, after just shortening it.

    Got an "Closing parenthesis expected in script", fixed it.. Look under
    SCAR Code:
    {*******************************************************************************
    procedure TypeSendEx(Text: string; PressEnter: Boolean);
    By: Shuttleu
    Description: Sends human like text.
    *******************************************************************************}

    procedure TypeSendEx(Text: string; PressEnter: Boolean);
    var
      S: string;
      I: Integer;
      D: Byte;
      A, B, C: Boolean;
    begin
      S:= 'ABCDEFGHIJKLMNOPQRSTUVWXZ' + '~!@#$%^&*()_+{}|:"<>?';
      for I:=0 to Length(Text) do
      begin
        A:= (Pos(Text[i], S) > 0);
        if (not(I = Length(Text))) then
          B:= (Pos(Text[I+1], S) > 0);
        if (not(I = 0)) then
          C:= (Pos(Text[I-1], S) > 0);
        D := GetKeyCode(Text[i]);
        if ((not(C)) and (A)) then
        begin
          KeyDown(VK_SHIFT);
          Wait(40 + Random(40));
        end;
        TypeByte(D);
        Wait(40 + Random(40));
        if (not(B))or(I = Length(Text)) then  // This line had the error.
        begin
          KeyUp(VK_SHIFT);
          Wait(40 + Random(40));
        end;
      end;
      if (not(PressEnter)) then Exit;
      D := GetKeyCode(Chr(13));
      TypeByte(D);
    end;


    Than I tested the function with this
    Note: The slight name change is to get rid of errors..
    SCAR Code:
    program New;
    {.include SRL/SRL.scar}

    {*******************************************************************************
    procedure TypeSendEx(Text: string; PressEnter: Boolean);
    By: Shuttleu
    Description: Sends human like text.
    *******************************************************************************}

    procedure n_TypeSendEx(Text: string; PressEnter: Boolean);
    var
      S: string;
      I: Integer;
      D: Byte;
      A, B, C: Boolean;
    begin
      S:= 'ABCDEFGHIJKLMNOPQRSTUVWXZ' + '~!@#$%^&*()_+{}|:"<>?';
      for I:=0 to Length(Text) do
      begin
        A:= (Pos(Text[i], S) > 0);
        if (not(I = Length(Text))) then
          B:= (Pos(Text[I+1], S) > 0);
        if (not(I = 0)) then
          C:= (Pos(Text[I-1], S) > 0);
        D := GetKeyCode(Text[i]);
        if ((not(C)) and (A)) then
        begin
          KeyDown(VK_SHIFT);
          Wait(40 + Random(40));
        end;
        TypeByte(D);
        Wait(40 + Random(40));
        if (not(B))or(I = Length(Text)) then
        begin
          KeyUp(VK_SHIFT);
          Wait(40 + Random(40));
        end;
      end;
      if (not(PressEnter)) then Exit;
      D := GetKeyCode(Chr(13));
      TypeByte(D);
    end;

    begin
      SetupSRL;
      Wait(2000);
      n_TypeSendEx('abcdefghijlgmnlopqrstouwz', False);
    end.

    But I got "[Runtime Error] : Out of string range in line 19 in script" while running it.

    Sorry for being such a killer..
    Last edited by Naike; 06-25-2009 at 07:46 AM.

  4. #4
    Join Date
    Aug 2007
    Location
    in a random little world
    Posts
    5,778
    Mentioned
    0 Post(s)
    Quoted
    7 Post(s)

  5. #5
    Join Date
    Apr 2007
    Location
    Perth, Australia
    Posts
    3,926
    Mentioned
    3 Post(s)
    Quoted
    2 Post(s)

    Default

    Chars in a string start at index 1. So it should be for I := 1 to Length(string) do

  6. #6
    Join Date
    Aug 2007
    Location
    in a random little world
    Posts
    5,778
    Mentioned
    0 Post(s)
    Quoted
    7 Post(s)

  7. #7
    Join Date
    Jan 2008
    Location
    California, US
    Posts
    2,765
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    You can do:
    SCAR Code:
    if uppercase(text[i]) = text[i] then
    //it's uppercase

  8. #8
    Join Date
    Aug 2007
    Location
    in a random little world
    Posts
    5,778
    Mentioned
    0 Post(s)
    Quoted
    7 Post(s)

  9. #9
    Join Date
    Jan 2008
    Location
    California, US
    Posts
    2,765
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    It does. I have my own TypeSend function which is shorter than yours.

  10. #10
    Join Date
    Aug 2007
    Location
    in a random little world
    Posts
    5,778
    Mentioned
    0 Post(s)
    Quoted
    7 Post(s)

  11. #11
    Join Date
    Jan 2008
    Location
    California, US
    Posts
    2,765
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    . I'll post mine in a few days. However I am grounded so cannot go on any computer.

  12. #12
    Join Date
    Aug 2007
    Location
    in a random little world
    Posts
    5,778
    Mentioned
    0 Post(s)
    Quoted
    7 Post(s)

  13. #13
    Join Date
    Dec 2008
    Posts
    2,813
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    iTouch/iPhone.. one of those two.

  14. #14
    Join Date
    Jan 2008
    Location
    California, US
    Posts
    2,765
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Yep, 99_ is right, <3 .

  15. #15
    Join Date
    Apr 2007
    Location
    Perth, Australia
    Posts
    3,926
    Mentioned
    3 Post(s)
    Quoted
    2 Post(s)

    Default

    How is this better than the current one though? I don't wanna fix something that isn't broken but might introduce more bugs.

  16. #16
    Join Date
    Jan 2008
    Location
    California, US
    Posts
    2,765
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Zeph, stay on for 2 or 3 hours and I will sneak on to post mine. Then you can commit it. I assure you that it is flawless .

  17. #17
    Join Date
    Mar 2007
    Posts
    4,810
    Mentioned
    3 Post(s)
    Quoted
    3 Post(s)

    Default

    SCAR Code:
    {*******************************************************************************
    procedure iType(Text : string; WaitTime : integer; Return : boolean);
    By: Da 0wner
    Description: Types text...
    *******************************************************************************}


    procedure iType(Text : string; WaitTime : integer; Return : boolean);
    var
      i: integer;
      s : string;
    begin
      s := '~!@#$%^&*()_+ABCDEFGHIJKLMNOPQRSTUVWXYZ{}|:"<>?';
      for i := 1 to Length(Text) do
      begin
        if  pos(Text[i], s) > 0 then
        begin
          KeyDown(VK_SHIFT);
          Wait(WaitTime + Random(40));
        end;
        KeyDown(GetKeyCode(Text[i]));
        Wait(WaitTime + Random(30));
        KeyUp(GetKeyCode(Text[i]));
        Wait(WaitTime + Random(30));
        if  pos(Text[i], s) > 0 then
          KeyUp(VK_SHIFT);
      end;
      if not Return then
        exit;
      Wait(10 + Random(30));
      KeyDown(VK_RETURN);
      Wait(10 + Random(30));
      KeyUp(VK_RETURN);
    end;

    ?

  18. #18
    Join Date
    Jul 2008
    Location
    England
    Posts
    763
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Quote Originally Posted by Da 0wner View Post
    Zeph, stay on for 2 or 3 hours and I will sneak on to post mine. Then you can commit it. I assure you that it is flawless .
    Da 0wner, your's and Shuttleu's are four lines different...
    Last edited by Quickmarch; 06-25-2009 at 11:20 PM.
    lol

  19. #19
    Join Date
    Apr 2007
    Location
    Perth, Australia
    Posts
    3,926
    Mentioned
    3 Post(s)
    Quoted
    2 Post(s)

    Default

    Quote Originally Posted by Da 0wner View Post
    Zeph, stay on for 2 or 3 hours and I will sneak on to post mine. Then you can commit it. I assure you that it is flawless .
    I'm not commiting stuff for no reason. =/

  20. #20
    Join Date
    Jul 2007
    Location
    Right now? Chair.
    Posts
    8,488
    Mentioned
    3 Post(s)
    Quoted
    12 Post(s)

    Default

    if it's not broken, don't fix it.

    ~RM

    I & I know Zion. It is in the spirit, body and mind of every one of us
    RMouse(obj: TMSIObject): boolean;

  21. #21
    Join Date
    Aug 2007
    Location
    in a random little world
    Posts
    5,778
    Mentioned
    0 Post(s)
    Quoted
    7 Post(s)

  22. #22
    Join Date
    Apr 2007
    Location
    Perth, Australia
    Posts
    3,926
    Mentioned
    3 Post(s)
    Quoted
    2 Post(s)

    Default

    Quote Originally Posted by Shuttleu View Post
    in the current one when typing more than one uppercase letter at a time it doesn't wait before typing them

    ~shut
    Can we not just add a wait to the current function then:

    SCAR Code:
    procedure TypeSendEx(Text: string; PressEnter: Boolean);
    var
      S: string;
      I, L: Integer;
      C: Byte;
      Shift: Boolean;
    begin
      S:= 'ABCDEFGHIJKLMNOPQRSTUVWXZ' + '~!@#$%^&*()_+{}|:"<>?';
      L := Length(Text);
      for I:= 1 to L do
      begin
        Shift:= (Pos(Text[i], S) > 0);
        if(Shift)then
        begin
          KeyDown(VK_SHIFT) Wait(40 + Random(40));
          while(Pos(Text[i], S) > 0)and(I <= Length(Text))do
          begin
            C := GetKeyCode(StrGet(Text, I));
            TypeByte(c);
            Wait(40 + Random(40)); //Here?
            I:= I + 1;
            if(I > Length(Text))then Break;
          end;
        end;
        if(Shift)then
          KeyUp(VK_SHIFT);
        Wait(40 + Random(40));
        if(I <= Length(Text))then
        begin
          C:= GetKeyCode(StrGet(Text, I));
          TypeByte(C);
          Wait(40 + Random(40));
        end;
      end;
      If Not PressEnter Then Exit;
      C := GetKeyCode(Chr(13));
      TypeByte(C);
    end;

  23. #23
    Join Date
    Jan 2008
    Location
    California, US
    Posts
    2,765
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Quote Originally Posted by Quickmarch View Post
    Da 0wner, your's and Shuttleu's are four lines different...
    That's an outdated function, Naum posted it .

Thread Information

Users Browsing this Thread

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

Tags for this Thread

Posting Permissions

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