[TUT - VB6] Simple human typer

Discussion in 'Programming General' started by Blupig, Nov 2, 2007.

[TUT - VB6] Simple human typer
  1. Unread #1 - Nov 2, 2007 at 7:21 AM
  2. Blupig
    Joined:
    Nov 23, 2006
    Posts:
    7,145
    Referrals:
    16
    Sythe Gold:
    1,609
    Discord Unique ID:
    178533992981594112
    Valentine's Singing Competition Winner Member of the Month Winner MushyMuncher Gohan has AIDS Extreme Homosex World War 3 I'm LAAAAAAAME
    Off Topic Participant

    Blupig BEEF TOILET
    $5 USD Donor

    [TUT - VB6] Simple human typer

    CONTROLS:
    -Textbox (2)
    -Command Button (2)
    -Timer (1) (Enabled = False, Interval = 1000)

    1. Place all your controls in a fashion that best suits you. Textbox #1 will be the message sent, the timer is how long it will take for the text to start sending (sort of pointless with a human typer), Textbox #2 will be the user's input for the timer's interval and the 2 command buttons are for start and stop.

    2. Add a module. This will contain all the crap for the human typing. Once you've added it, pop in these declarations at the top:

    Code:
    Public Declare Function IsCharUpper Lib "user32" Alias "IsCharUpperA" (ByVal cChar As Byte) As Long
    Public Declare Function timeGetTime Lib "winmm.dll" () As Long
    
    The first declaration is to determine if letters are upper case in the mistake coding, to match the lower case mistake groups (if you don't understand that you'll figure it out eventually, just look at the code and you should get it). The second declaration tells the application to get the system's time in the file winmm.dll which is located somewhere in your windows installation directory. That's for the wait function, see next.

    3. Next comes the wait function. This is the almighty function that is extremely useful in many applications. You might want to save this somewhere as it WILL come in use for future projects of yours. Add this below your declarations:

    Code:
    Public Function Wait(TimeOut)
       Dim TimeNow As Long
       On Error Resume Next
       TimeNow = timeGetTime()
       Do
          DoEvents
       Loop While TimeNow + TimeOut > timeGetTime()
    End Function
    
    ^^By Jazz (who I first got it from)

    The wait function is really basic; it tells the application to wait for # seconds using the syntax Wait(#). In our typer, it will be used to tell the application to wait between each letter typed, with a random interval offset which we'll go over later.

    4. Here comes the human typing function! Put it below your wait function.

    Code:
    Public Function SmartType(Text As String, Pause As Long, Mistake As Long, Enter As Boolean)
       Dim NewLetter As String
       Randomize
       For i = 1 To Len(Text)
          If Int(Mistake * Rnd) = 0 Then
             If SmartMistake(Mid(Text, i, 1), NewLetter) = True Then
                SendKeys NewLetter
                Wait (Int(Rnd * Pause))
                SendKeys "{BS}"
                Wait (Int(Rnd * Pause))
             End If
          End If
          SendKeys (Mid$(Text, i, 1))
          Wait (Int(Rnd * Pause))
       Next i
       If Enter = True Then SendKeys "{ENTER}"
    End Function
    
    ^^By Terrankiller

    This is kind of complicated and I really only understand half of it myself, but I know what it does. It grabs each letter of the message you want to send, then tells be application to wait # of seconds (determined in timer code in form1, we'll look at that later) + a random offset to avoid a ban. Then, this SmartType function teams up with the SmartMistake function (see next) which basically makes mistakes in the message to avoid ban even more. Finally, the string "NewLetter" is sent, one by one (newletter is each individual character of the message) with the help of SmartMistake for an anti-ban.

    5. Mistakes! Add this code below the SmartType function we looked over earlier:

    Code:
    Public Function SmartMistake(Letter As String, MistakenLetter As String) As Boolean
       Dim Char As String, Char2() As String, Upper As Boolean, Found As Boolean
       Randomize
       Char = "abcdefghijklmnopqrstuvwxyz1234567890"
       Char2() = Split("sq|vn|xv|sf|wr|dg|fh|gj|uo|hk|jl|k;|n,|bm|ip|o[|wa|et|ad|ry|yi|cb|qe|zc|tu|xsa|`2|13|24|35|46|57|68|79|80|9-", "|")
       Upper = IsCharUpper(Asc(Letter))
       If IsNumeric(Letter) = False Then LCase (Letter)
       For c = 1 To Len(Char)
          If Mid(Char, c, 1) = Letter Then
             MistakenLetter = Mid(Char2(c - 1), Int(Len(Char2(c - 1)) * Rnd + 1), 1)
             c = Len(Char)
             Found = True
             SmartMistake = True
          End If
       Next c
       If Upper = True Then UCase (Mistake)
       If Found = False Then MistakenLetter = Letter: If Upper = True Then UCase (MistakenLetter): SmartMistake = False
    End Function
    
    ^^By Terrankiller and/or Cruel :S

    Wow. OK. I understand this function even less that SmartType, this is pretty advanced stuff. Anyways, what this does is each alphabetical and numerical characters are told to the application, then set into groups. Each character is matched into a group, so for example group 1 is sq. If s is typed, q will be instead (depending on the mistake chance).

    6. This next chunk of code is the random interval function, which may be small but is the reinforcement of our anti-ban system. It adds a random offset to each other the typer's sent letters, so it is actually impossible to detect autotyping because each letter is typed out of the set sequence. Add this below the SmartMistake function:

    Code:
    Public Function RandomInt(ByVal Low As Long, ByVal High As Long) As Long
       Randomize: RandomInt = Int((High - Low + 1) * Rnd) + Low
    End Function
    
    Your module is now complete!

    7. Rename your interval's textbox to txtInterval. Now, double click your start command button (rename it to cmdStart) and add this code:

    Code:
    Private Sub cmdStart_Click()
    Timer1.Interval = txtInterval.Text
    Timer1.Enabled = True
    End Sub
    
    This tells the timer that it's interval is equal to the number entered in txtInterval by the user. Then, the timer is enabled (the timer contains the SmartType call).

    8. The stop button is basically the same, except is makes the timer disable. Rename the stop command button to cmdStop.

    Code:
    Private Sub cmdStop_Click()
    Timer1.Enabled = False
    End Sub
    
    9. Now, we're going to call on our SmartType function, to send the text in the message textbox (rename it to txtMessage). Add this into your timer's code:

    Code:
    Private Sub Timer1_Timer()
    SmartType txtMessage.Text, Typing Speed, Mistake Chance, True
    End Sub
    
    Put in whatever you want for the Typing Speed and the Mistake Chance values. I find that a typing speed of 350 and a mistake chance of 100-200 works rather well. That "True" part at the end determines if enter is to be pressed after the message is done being sent. For runescape or any other games that require you to press enter to send text, you have to keep this setting to "True".

    -------------------------

    You think you're done? Well, you'll never be done. There are plenty of things you can add to this, such as:
    -User input for Typing Speed and Mistake Chance
    -List messaging (to enable an undefined amount of messages)
    -Hotkeys
    -Text effects
    -Fancy skins
    -Double function: sendkeys and SmartType
    -Etc. etc.

    -------------------------

    Tutorial brought to you by Blupig, content of module created by Terrankiller, Jazz, Cruel. Thanks for their share, it makes all of our jobs easier ;)
     
  3. Unread #2 - Dec 10, 2008 at 2:11 PM
  4. kridan500
    Joined:
    Feb 11, 2007
    Posts:
    217
    Referrals:
    1
    Sythe Gold:
    0

    kridan500 Active Member
    Banned

    [TUT - VB6] Simple human typer

    it doesent work for me
     
  5. Unread #3 - Dec 20, 2008 at 2:07 PM
  6. Blupig
    Joined:
    Nov 23, 2006
    Posts:
    7,145
    Referrals:
    16
    Sythe Gold:
    1,609
    Discord Unique ID:
    178533992981594112
    Valentine's Singing Competition Winner Member of the Month Winner MushyMuncher Gohan has AIDS Extreme Homosex World War 3 I'm LAAAAAAAME
    Off Topic Participant

    Blupig BEEF TOILET
    $5 USD Donor

    [TUT - VB6] Simple human typer

    For the mistake chance, try using a setting of 350.
     
  7. Unread #4 - Dec 21, 2008 at 1:25 AM
  8. Nullware
    Joined:
    Jan 30, 2007
    Posts:
    1,761
    Referrals:
    4
    Sythe Gold:
    0

    Nullware Guru

    [TUT - VB6] Simple human typer

    Haha I'm gonna see if I can dig up mine somewhere on my old hard drive. I remember writing my own mistake function even though Cruel's was out there anyway.
     
  9. Unread #5 - Feb 15, 2009 at 1:49 PM
  10. JustWondering
    Joined:
    Jan 23, 2009
    Posts:
    127
    Referrals:
    0
    Sythe Gold:
    0

    JustWondering Active Member

    [TUT - VB6] Simple human typer

    If your making an auto talker for an online game, SendKeys would be better. I mean I see level 138's auto talking all the time every milli-second and a month later they aren't even banned. So I really don't see the point of human like typing. Maybe if your making a video and your a slow typer but you want a realistic typing effect, this would be good, but otherwise...ehh.
     
  11. Unread #6 - Feb 16, 2009 at 1:21 AM
  12. Swan
    Joined:
    Jan 23, 2007
    Posts:
    4,957
    Referrals:
    0
    Sythe Gold:
    0
    Sythe's 10th Anniversary Member of the Month Winner

    Swan When They Cry...
    Retired Global Moderator

    [TUT - VB6] Simple human typer

    He is using SendKeys, what's your point?

    If anything I'd use the SendMessage Win32 function (I believe that can be used, I may be thinking of something else).
     
  13. Unread #7 - Feb 16, 2009 at 1:33 AM
  14. Trace
    Joined:
    Dec 29, 2008
    Posts:
    13
    Referrals:
    0
    Sythe Gold:
    0

    Trace Newcomer

    [TUT - VB6] Simple human typer

    Yeah swan i think your right
    then you dont even need focus
     
< java error 1330 | Auto login for vb6 webbrowser >

Users viewing this thread
1 guest


 
 
Adblock breaks this site