Page 1 of 2 12 LastLast
Results 1 to 15 of 30
  1. #1
    silentrunner2's Avatar
    Join Date
    Jun 2008
    Gender
    male
    Posts
    629
    Reputation
    110
    Thanks
    2,870
    My Mood
    Busy

    Delay Code? Make Account Bot Look Human

    Someone help and old noob out im making an account creator and for numerous reasons i want the program to fill in the form slowly, so it looks more human and also for other reasons, so for example if I have code like this

    Code:
    WebBrowser1.Document.GetElementById("iFirstName").Focus()
    WebBrowser1.Document.GetElementById("iFirstName").SetAttribute("value", TextBox1.Text)
    WebBrowser1.Document.GetElementById("iLastName").Focus()
    WebBrowser1.Document.GetElementById("iLastName").SetAttribute("value", TextBox2.Text)
    WebBrowser1.Document.GetElementById("iBirthDay").Focus()
    WebBrowser1.Document.GetElementById("iBirthDay").SetAttribute("value", ComboBox2.Text)
    WebBrowser1.Document.GetElementById("iBirthMonth").Focus()
    WebBrowser1.Document.GetElementById("iBirthMonth").SetAttribute("value", ComboBox1.Text)
    WebBrowser1.Document.GetElementById("iBirthYear").Focus()
    WebBrowser1.Document.GetElementById("iBirthYear").SetAttribute("value", ComboBox3.Text)
    It fills in everything instantly, I want a way so it maybe waits a second before filling in the next box. I have tryed the sleep function that works but freezes up the program just looks really bad. Also tryed a delay function using a module, it was a tut i found but that didn't seem to work either. Ow and btw reason im using .Focus() is because im using a small browser so it will move into view. Anyways any help would be greatly appreciated as this is something i have wanted to learn for along time.

    Thanks
    Last edited by silentrunner2; 04-25-2013 at 06:04 PM.
    My Projects


    Don't Ask For Thanks Earn It
    You: "Please Give Thanks"
    Me: "...................No"

  2. #2
    abuckau907's Avatar
    Join Date
    Dec 2012
    Gender
    male
    Location
    other side of the wire
    Posts
    1,342
    Reputation
    162
    Thanks
    239
    My Mood
    Cold
    Threading.Thread.Sleep(xx) '' xx is in milliseconds. 1000 ms = 1 sec.

    Maybe. ?
    'Some things that can be counted, don't matter. And some things that matter, can't be counted' - A.E.
    --
     

    My posts have some inaccuracies/are wrong/wrong keyword(s) used.
    They're (maybe) pretty close, and I hope they helped you, not created confusion. Take with grain of salt.

    -if you give rep, please leave a comment, else it means less.

  3. #3
    rabbit.coder's Avatar
    Join Date
    Mar 2013
    Gender
    male
    Posts
    29
    Reputation
    10
    Thanks
    50
    Maybe try a chain of timers with the Interval set at 1000

    eg

    Code:
    Private Sub Timer1_Tick(sender As Object, e As EventArgs) Handles Timer1.Tick
        WebBrowser1.Document.GetElementById("iFirstName").Focus()
        WebBrowser1.Document.GetElementById("iFirstName").SetAttribute("value", TextBox1.Text)
        Timer2.Enabled = True
        Timer1.Enabled = False
    End Sub
    Code:
    Private Sub Timer2_Tick(sender As Object, e As EventArgs) Handles Timer1.Tick
        WebBrowser1.Document.GetElementById("iLastName").Focus()
        WebBrowser1.Document.GetElementById("iLastName").SetAttribute("value", TextBox2.Text)
        Timer3.Enabled = True
        Timer2.Enabled = False
    End Sub
    Last edited by rabbit.coder; 04-25-2013 at 10:03 PM. Reason: missing bits

  4. #4
    pootuba's Avatar
    Join Date
    Feb 2013
    Gender
    male
    Posts
    13
    Reputation
    10
    Thanks
    1
    Private Declare Function GetTickCount Lib "kernel32" () As Long

    Sub Wait(ByVal cTime As Long)
    Dim sTime As Long

    sTime = GetTickCount + cTime

    Do While sTime >= GetTickCount
    Application.DoEvents()
    Loop
    End Sub

  5. #5
    abuckau907's Avatar
    Join Date
    Dec 2012
    Gender
    male
    Location
    other side of the wire
    Posts
    1,342
    Reputation
    162
    Thanks
    239
    My Mood
    Cold
    -Trying to keep it similar to your original / add as little new code as possible
    Code:
    Dim aRandomNumber As New Random() '' Used to generate random numbers (pseudo-random..)
    
    WebBrowser1.Document.GetElementById("iFirstName").Focus()
    WebBrowser1.Document.GetElementById("iFirstName").SetAttribute("value", TextBox1.Text)
    Threading.Thread.Sleep(aRandomNumber.GetNext(1000,2000)) ''Get a random number between 1000 and 2000 (1 to 2 seconds)
    WebBrowser1.Document.GetElementById("iLastName").Focus()
    WebBrowser1.Document.GetElementById("iLastName").SetAttribute("value", TextBox2.Text)
    Threading.Thread.Sleep(aRandomNumber.GetNext(1000,2000))
    WebBrowser1.Document.GetElementById("iBirthDay").Focus()
    WebBrowser1.Document.GetElementById("iBirthDay").SetAttribute("value", ComboBox2.Text)
    Threading.Thread.Sleep(aRandomNumber.GetNext(1000,2000))
    WebBrowser1.Document.GetElementById("iBirthMonth").Focus()
    WebBrowser1.Document.GetElementById("iBirthMonth").SetAttribute("value", ComboBox1.Text)
    Threading.Thread.Sleep(aRandomNumber.GetNext(1000,2000))
    WebBrowser1.Document.GetElementById("iBirthYear").Focus()
    WebBrowser1.Document.GetElementById("iBirthYear").SetAttribute("value", ComboBox3.Text)
    Threading.Thread.Sleep(aRandomNumber.GetNext(1000,2000)) 'maybe not needed here. ?
    or even,
    Code:
    Dim aRandomNumber As New Random() '' Used to generate random numbers (pseudo-random..)
    Dim minSleepTime as Int32 = 1000 '' in milliseconds, should be a const
    Dim maxSleepTime as Int32 = 2000 '' in milliseconds, should be a const
    
    WebBrowser1.Document.GetElementById("iFirstName").Focus()
    WebBrowser1.Document.GetElementById("iFirstName").SetAttribute("value", TextBox1.Text)
    Threading.Thread.Sleep(aRandomNumber.GetNext(minSleepTime ,maxSleepTime)) ''Get a random number between min and max
    WebBrowser1.Document.GetElementById("iLastName").Focus()
    WebBrowser1.Document.GetElementById("iLastName").SetAttribute("value", TextBox2.Text)
    Threading.Thread.Sleep(aRandomNumber.GetNext(minSleepTime ,maxSleepTime))
    WebBrowser1.Document.GetElementById("iBirthDay").Focus()
    WebBrowser1.Document.GetElementById("iBirthDay").SetAttribute("value", ComboBox2.Text)
    Threading.Thread.Sleep(aRandomNumber.GetNext(minSleepTime ,maxSleepTime))
    WebBrowser1.Document.GetElementById("iBirthMonth").Focus()
    WebBrowser1.Document.GetElementById("iBirthMonth").SetAttribute("value", ComboBox1.Text)
    Threading.Thread.Sleep(aRandomNumber.GetNext(minSleepTime ,maxSleepTime))
    WebBrowser1.Document.GetElementById("iBirthYear").Focus()
    WebBrowser1.Document.GetElementById("iBirthYear").SetAttribute("value", ComboBox3.Text)
    Threading.Thread.Sleep(aRandomNumber.GetNext(minSleepTime ,maxSleepTime)) 'maybe not needed here. ?
    -I think*, because this is going through a web-browser...generally there is nothing keeping track of "how fast" you type something in / how fast you switch between fields. With that being said..why not : )
    Last edited by abuckau907; 04-25-2013 at 11:09 PM. Reason: missing closing paren.
    'Some things that can be counted, don't matter. And some things that matter, can't be counted' - A.E.
    --
     

    My posts have some inaccuracies/are wrong/wrong keyword(s) used.
    They're (maybe) pretty close, and I hope they helped you, not created confusion. Take with grain of salt.

    -if you give rep, please leave a comment, else it means less.

  6. #6
    silentrunner2's Avatar
    Join Date
    Jun 2008
    Gender
    male
    Posts
    629
    Reputation
    110
    Thanks
    2,870
    My Mood
    Busy
    Quote Originally Posted by pootuba View Post
    Private Declare Function GetTickCount Lib "kernel32" () As Long

    Sub Wait(ByVal cTime As Long)
    Dim sTime As Long

    sTime = GetTickCount + cTime

    Do While sTime >= GetTickCount
    Application.DoEvents()
    Loop
    End Sub
    Hi thanks for your input, im not sure if im executing this wrong but it seems to loop my code over and over so it doesn't stop running?

    Quote Originally Posted by abuckau907 View Post
    -Trying to keep it similar to your original / add as little new code as possible
    Code:
    Dim aRandomNumber As New Random() '' Used to generate random numbers (pseudo-random..)
    
    WebBrowser1.Document.GetElementById("iFirstName").Focus()
    WebBrowser1.Document.GetElementById("iFirstName").SetAttribute("value", TextBox1.Text)
    Threading.Thread.Sleep(aRandomNumber.GetNext(1000,  2000)) ''Get a random number between 1000 and 2000 (1 to 2 seconds)
    WebBrowser1.Document.GetElementById("iLastName").Focus()
    WebBrowser1.Document.GetElementById("iLastName").SetAttribute("value", TextBox2.Text)
    Threading.Thread.Sleep(aRandomNumber.GetNext(1000,  2000))
    WebBrowser1.Document.GetElementById("iBirthDay").Focus()
    WebBrowser1.Document.GetElementById("iBirthDay").SetAttribute("value", ComboBox2.Text)
    Threading.Thread.Sleep(aRandomNumber.GetNext(1000,  2000))
    WebBrowser1.Document.GetElementById("iBirthMonth").Focus()
    WebBrowser1.Document.GetElementById("iBirthMonth").SetAttribute("value", ComboBox1.Text)
    Threading.Thread.Sleep(aRandomNumber.GetNext(1000,  2000))
    WebBrowser1.Document.GetElementById("iBirthYear").Focus()
    WebBrowser1.Document.GetElementById("iBirthYear").SetAttribute("value", ComboBox3.Text)
    Threading.Thread.Sleep(aRandomNumber.GetNext(1000,  2000)) 'maybe not needed here. ?
    or even,
    Code:
    Dim aRandomNumber As New Random() '' Used to generate random numbers (pseudo-random..)
    Dim minSleepTime as Int32 = 1000 '' in milliseconds, should be a const
    Dim maxSleepTime as Int32 = 2000 '' in milliseconds, should be a const
    
    WebBrowser1.Document.GetElementById("iFirstName").Focus()
    WebBrowser1.Document.GetElementById("iFirstName").SetAttribute("value", TextBox1.Text)
    Threading.Thread.Sleep(aRandomNumber.GetNext(minSl  eepTime ,maxSleepTime)) ''Get a random number between min and max
    WebBrowser1.Document.GetElementById("iLastName").Focus()
    WebBrowser1.Document.GetElementById("iLastName").SetAttribute("value", TextBox2.Text)
    Threading.Thread.Sleep(aRandomNumber.GetNext(minSl  eepTime ,maxSleepTime))
    WebBrowser1.Document.GetElementById("iBirthDay").Focus()
    WebBrowser1.Document.GetElementById("iBirthDay").SetAttribute("value", ComboBox2.Text)
    Threading.Thread.Sleep(aRandomNumber.GetNext(minSl  eepTime ,maxSleepTime))
    WebBrowser1.Document.GetElementById("iBirthMonth").Focus()
    WebBrowser1.Document.GetElementById("iBirthMonth").SetAttribute("value", ComboBox1.Text)
    Threading.Thread.Sleep(aRandomNumber.GetNext(minSl  eepTime ,maxSleepTime))
    WebBrowser1.Document.GetElementById("iBirthYear").Focus()
    WebBrowser1.Document.GetElementById("iBirthYear").SetAttribute("value", ComboBox3.Text)
    Threading.Thread.Sleep(aRandomNumber.GetNext(minSl  eepTime ,maxSleepTime)) 'maybe not needed here. ?
    -I think*, because this is going through a web-browser...generally there is nothing keeping track of "how fast" you type something in / how fast you switch between fields. With that being said..why not : )
    The sleep method works but for me but it freezes up the whole program so I can't see whats going on. I was also looking around a found this method but that seems to mess with the browser and freeze it.
    My Projects


    Don't Ask For Thanks Earn It
    You: "Please Give Thanks"
    Me: "...................No"

  7. #7
    abuckau907's Avatar
    Join Date
    Dec 2012
    Gender
    male
    Location
    other side of the wire
    Posts
    1,342
    Reputation
    162
    Thanks
    239
    My Mood
    Cold
    Wow sorry, somehow I totally missed the part about you already trying .Sleep() and not liking the 'gui freeze.'

    I guess the easiest way (without having to explain a whole lot) would be to do as pootuba said and making a custon wait function: the key part is calling Application.DoEvents()
    ..from post above..
    Code:
    Sub Wait(ByVal cTime As Long)
    Dim sTime As Long
    
    sTime = GetTickCount + cTime
    
    Do While sTime >= GetTickCount
    Application.DoEvents()
    Loop
    End Sub
    the parameter cTime is the number of "ticks" to wait, a tick being some very small fraction of a second. (idk off top of my head..) This is probably the easiest way. Replace all of the System.Threading.Sleep() calls with a call to the above Sub.
    'Some things that can be counted, don't matter. And some things that matter, can't be counted' - A.E.
    --
     

    My posts have some inaccuracies/are wrong/wrong keyword(s) used.
    They're (maybe) pretty close, and I hope they helped you, not created confusion. Take with grain of salt.

    -if you give rep, please leave a comment, else it means less.

  8. #8
    silentrunner2's Avatar
    Join Date
    Jun 2008
    Gender
    male
    Posts
    629
    Reputation
    110
    Thanks
    2,870
    My Mood
    Busy
    Quote Originally Posted by abuckau907 View Post
    Wow sorry, somehow I totally missed the part about you already trying .Sleep() and not liking the 'gui freeze.'

    I guess the easiest way (without having to explain a whole lot) would be to do as pootuba said and making a custon wait function: the key part is calling Application.DoEvents()
    ..from post above..
    Code:
    Sub Wait(ByVal cTime As Long)
    Dim sTime As Long
    
    sTime = GetTickCount + cTime
    
    Do While sTime >= GetTickCount
    Application.DoEvents()
    Loop
    End Sub
    the parameter cTime is the number of "ticks" to wait, a tick being some very small fraction of a second. (idk off top of my head..) This is probably the easiest way. Replace all of the System.Threading.Sleep() calls with a call to the above Sub.
    Hey thanks for coming back to me, I used that code it seemed to work alittle better but once it finished it seemed to make my code run over and over i tryed removing the loop but had the same problem. Im i doing something really stupid, i used the function and then called it between codes like so "wait(10)"

    Btw im running the code in a timer could not cause a problem, after it completes the timer is turned off could this maybe be conflicting with it somehow.

    Thanks
    Last edited by silentrunner2; 04-26-2013 at 05:18 AM.
    My Projects


    Don't Ask For Thanks Earn It
    You: "Please Give Thanks"
    Me: "...................No"

  9. #9
    Pingo's Avatar
    Join Date
    Apr 2010
    Gender
    male
    Posts
    687
    Reputation
    24
    Thanks
    865
    My Mood
    Blah
    abuckau907 method will work, you just need to run the code in another thread so it doesnt freeze your app.

    Code:
        Sub RunCode()
            'Code here
        End Sub
    Call it from whatever method you want
    Code:
        Dim T As System.Threading.Thread = New System.Threading.Thread(AddressOf RunCode)
        T.Start()

  10. #10
    silentrunner2's Avatar
    Join Date
    Jun 2008
    Gender
    male
    Posts
    629
    Reputation
    110
    Thanks
    2,870
    My Mood
    Busy
    Just seems to freeze up the browser :/
    My Projects


    Don't Ask For Thanks Earn It
    You: "Please Give Thanks"
    Me: "...................No"

  11. #11
    abuckau907's Avatar
    Join Date
    Dec 2012
    Gender
    male
    Location
    other side of the wire
    Posts
    1,342
    Reputation
    162
    Thanks
    239
    My Mood
    Cold
    @silentrunner2 plz post any code you feel is relevant. Timers shouldn't be needed, but of course *could* work. Post the code and we'll see.
    - when you tried pingos threaded method, did you replace " 'code here " with all the webbrowser1 related code : you didn't leave it a blank sub, right? Silly question, but it's been known to happen.
    'Some things that can be counted, don't matter. And some things that matter, can't be counted' - A.E.
    --
     

    My posts have some inaccuracies/are wrong/wrong keyword(s) used.
    They're (maybe) pretty close, and I hope they helped you, not created confusion. Take with grain of salt.

    -if you give rep, please leave a comment, else it means less.

  12. #12
    silentrunner2's Avatar
    Join Date
    Jun 2008
    Gender
    male
    Posts
    629
    Reputation
    110
    Thanks
    2,870
    My Mood
    Busy
    Quote Originally Posted by abuckau907 View Post
    @silentrunner2 plz post any code you feel is relevant. Timers shouldn't be needed, but of course *could* work. Post the code and we'll see.
    - when you tried pingos threaded method, did you replace " 'code here " with all the webbrowser1 related code : you didn't leave it a blank sub, right? Silly question, but it's been known to happen.
    I didn't quite understand Pingos methods I gave it a try it ran without errors but didn't seem to work. Here is what i have at the moment it might give you a better idea of what im trying to achieve and thanks for being patient with me my knowledge is pretty basic, as you will see I don't have any code you guys recommended at the moment I removed it so I could carry on without a delay for now.

    Code:
        Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
            WebBrowser1.Navigate("https://login.live.com")
            TabControl1.SelectTab(1)
        End Sub
        Private Sub WebBrowser1_DocumentCompleted(ByVal sender As System.Object, ByVal e As System.Windows.Forms.WebBrowserDocumentCompletedEventArgs) Handles WebBrowser1.DocumentCompleted
            If WebBrowser1.DocumentTitle = "Sign in to your Microsoft account" And WebBrowser1.Url.ToString.StartsWith("https://login.live.com/") Then
                Hotmail.Enabled = True
            End If
            If WebBrowser1.DocumentTitle = "Sign up - Microsoft account" Then
                Hotmail2.Enabled = True
            End If
            If WebBrowser1.DocumentTitle.ToString.StartsWith("Outlook - " + TextBox3.Text) Then
                MsgBox("Your account has been successfully created and the details saved in the history tab")
            End If
        End Sub
        Private Sub Hotmail_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Hotmail.Tick
            WebBrowser1.Document.GetElementById("idA_SignUp").Focus()
            WebBrowser1.Document.GetElementById("idA_SignUp").InvokeMember("click")
            Hotmail.Enabled = False
        End Sub
        Private Sub Hotmail2_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Hotmail2.Tick
            Try
                WebBrowser1.Document.GetElementById("iFirstName").Focus()
                WebBrowser1.Document.GetElementById("iFirstName").SetAttribute("value", TextBox1.Text)
                WebBrowser1.Document.GetElementById("iLastName").Focus()
                WebBrowser1.Document.GetElementById("iLastName").SetAttribute("value", TextBox2.Text)
                WebBrowser1.Document.GetElementById("iBirthDay").Focus()
                WebBrowser1.Document.GetElementById("iBirthDay").SetAttribute("value", ComboBox2.Text)
                WebBrowser1.Document.GetElementById("iBirthMonth").Focus()
                WebBrowser1.Document.GetElementById("iBirthMonth").SetAttribute("value", ComboBox1.Text)
                WebBrowser1.Document.GetElementById("iBirthYear").Focus()
                WebBrowser1.Document.GetElementById("iBirthYear").SetAttribute("value", ComboBox3.Text)
                WebBrowser1.Document.GetElementById("imembernameeasi").Focus()
                WebBrowser1.Document.GetElementById("imembernameeasi").SetAttribute("value", TextBox3.Text)
                WebBrowser1.Document.GetElementById("iPwd").Focus()
                WebBrowser1.Document.GetElementById("iPwd").SetAttribute("value", TextBox4.Text)
                WebBrowser1.Document.GetElementById("iRetypePwd").Focus()
                WebBrowser1.Document.GetElementById("iRetypePwd").SetAttribute("value", TextBox4.Text)
                WebBrowser1.Document.GetElementById("iPhone").Focus()
                WebBrowser1.Document.GetElementById("iPhone").SetAttribute("value", TextBox5.Text)
                WebBrowser1.Document.GetElementById("iAltEmail").Focus()
                WebBrowser1.Document.GetElementById("iAltEmail").SetAttribute("value", TextBox6.Text)
                WebBrowser1.Document.GetElementById("iZipCode").Focus()
                WebBrowser1.Document.GetElementById("iZipCode").SetAttribute("value", TextBox7.Text)
                WebBrowser1.Document.GetElementById("iBirthYear").Focus()
                SendKeys.Send("{TAB}")
                SendKeys.Send("{DOWN}")
                Hotmail2.Enabled = False
                MsgBox("Filling in the form has comepleted, please scroll to the bottom of the page and comeplete the captcha")
                WebBrowser1.Document.GetElementById("iBirthYear").Focus()
                SendKeys.Send("{TAB}")
                SendKeys.Send("{DOWN}")
                Hotmail2.Enabled = False
            Catch ex As Exception
                Hotmail2.Enabled = False
                MsgBox("something went wrong the form was unable to be comepleted")
                Hotmail2.Enabled = False
            End Try
        End Sub
    My Projects


    Don't Ask For Thanks Earn It
    You: "Please Give Thanks"
    Me: "...................No"

  13. #13
    Pingo's Avatar
    Join Date
    Apr 2010
    Gender
    male
    Posts
    687
    Reputation
    24
    Thanks
    865
    My Mood
    Blah
    Another thing to note, if you're creating a thread dont do it within the timer.
    Remove the timer since you dont really need it unless you use it for something else.
    Your GUI will not freeze up if you run the code in another thread.

    If you run the code in the main thread, of course the GUI will freeze since you're telling the main thread to sleep for x amount of time.

  14. #14
    Biesi's Avatar
    Join Date
    Dec 2011
    Gender
    male
    Posts
    4,993
    Reputation
    374
    Thanks
    8,808
    My Mood
    Twisted
    Code:
    private declare sub sleep lib "kernel32" (byval dwMilliseconds as long)
    
    sleep(1000)
    Last edited by Biesi; 04-26-2013 at 07:38 AM.

  15. #15
    silentrunner2's Avatar
    Join Date
    Jun 2008
    Gender
    male
    Posts
    629
    Reputation
    110
    Thanks
    2,870
    My Mood
    Busy
    Quote Originally Posted by Pingo View Post
    Another thing to note, if you're creating a thread dont do it within the timer.
    Remove the timer since you dont really need it unless you use it for something else.
    Your GUI will not freeze up if you run the code in another thread.

    If you run the code in the main thread, of course the GUI will freeze since you're telling the main thread to sleep for x amount of time.
    So these sleep methods won't work in a timer?
    My Projects


    Don't Ask For Thanks Earn It
    You: "Please Give Thanks"
    Me: "...................No"

Page 1 of 2 12 LastLast

Similar Threads

  1. Looking for AWM Code or account.
    By Verial in forum Trade Accounts/Keys/Items
    Replies: 5
    Last Post: 06-18-2009, 12:32 PM
  2. [help] making account and playing warrock
    By Darky in forum WarRock Korea Hacks
    Replies: 6
    Last Post: 07-05-2007, 08:43 PM
  3. well make accounts!!!!!!!
    By damanis1 in forum WarRock Korea Hacks
    Replies: 13
    Last Post: 05-12-2007, 02:10 PM
  4. Make Accounts
    By ktalin91 in forum WarRock Korea Hacks
    Replies: 0
    Last Post: 05-09-2007, 01:32 PM
  5. Make accounts for US version?
    By chris9273 in forum WarRock - International Hacks
    Replies: 1
    Last Post: 05-28-2006, 11:31 AM