What code can I use so that the program checks to see if the website is fully loaded, then changes? Btw thanks for the heads-up about the code tags, didn't think about it.
(May 12, 2022 10:16 AM)Goku Wrote: Doesn't change the fact that a human sperm is as human as we are.
DO NOT DEAL WITH THIS MEMBER
Mar 28, 2014 09:12 PM
(This post was last modified: Mar 28, 2014 09:21 PM by chaddiablo.)
(Mar 28, 2014 01:16 PM)Vipеr Wrote: What code can I use so that the program checks to see if the website is fully loaded, then changes? Btw thanks for the heads-up about the code tags, didn't think about it.
Code Private Sub WebBrowser1_DocumentCompleted(ByVal sender As System.Object, ByVal e As System.Windows.Forms.WebBrowserDocumentCompletedEventArgs) Handles WebBrowser1.DocumentCompleted
WebBrowser1.Navigate(TextBox1.Text)
End Sub
If you need additional help LMK, I've already built multiple bots like this.
PS. Don't use rich text box, if you want more lines on the text use 'ListBox' Ex:
Code Listbox1.Items.Item(0)
This will use the first line you have in the listbox
PS..PS...
Don't use thread sleep. Create a timer event.
Code Private Sub WebBrowser1_DocumentCompleted(ByVal sender As System.Object, ByVal e As System.Windows.Forms.WebBrowserDocumentCompletedEventArgs) Handles WebBrowser1.DocumentCompleted
Timer1.Start()
End Sub
Code Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick
WebBrowser1.Navigate(Listbox1.Items.Item(0))
Timer2.Start()
End Sub
You get the point
Chaddiablo
(Mar 28, 2014 09:12 PM)chaddiablo Wrote: Code Private Sub WebBrowser1_DocumentCompleted(ByVal sender As System.Object, ByVal e As System.Windows.Forms.WebBrowserDocumentCompletedEventArgs) Handles WebBrowser1.DocumentCompleted
WebBrowser1.Navigate(TextBox1.Text)
End Sub
If you need additional help LMK, I've already built multiple bots like this.
PS. Don't use rich text box, if you want more lines on the text use 'ListBox' Ex:
Code Listbox1.Items.Item(0)
This will use the first line you have in the listbox
PS..PS...
Don't use thread sleep. Create a timer event.
Code Private Sub WebBrowser1_DocumentCompleted(ByVal sender As System.Object, ByVal e As System.Windows.Forms.WebBrowserDocumentCompletedEventArgs) Handles WebBrowser1.DocumentCompleted
Timer1.Start()
End Sub
Code Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick
WebBrowser1.Navigate(Listbox1.Items.Item(0))
Timer2.Start()
End Sub
You get the point
Chaddiablo
i suggest you learn before trying to teach also.
DO NOT DEAL WITH THIS MEMBER
Mar 29, 2014 05:46 PM
(This post was last modified: Mar 29, 2014 10:49 PM by chaddiablo.)
(Mar 29, 2014 02:56 PM)ident Wrote: i suggest you learn before trying to teach also. It may be bad coding but, I've already made one with this method.
(Mar 28, 2014 01:16 PM)Vipеr Wrote: What code can I use so that the program checks to see if the website is fully loaded, then changes? Btw thanks for the heads-up about the code tags, didn't think about it.
Code Dim i As Integer = 0
Private Sub WebBrowser1_DocumentCompleted(ByVal sender As System.Object, ByVal e As System.Windows.Forms.WebBrowserDocumentCompletedEventArgs) Handles WebBrowser1.DocumentCompleted
If i >= RichTextBox1.Lines.Length - 1 Then
i = 0
WebBrowser1.Navigate(RichTextBox1.Lines(i))
Else
i += 1
WebBrowser1.Navigate(RichTextBox1.Lines(i))
End If
End Sub
Typed from memory without testing, but that should continuously loop through the websites
I tried out the code and it worked perfectly, thanks!
Code Public Class Form1
Dim i As Integer = 0
Private Sub WebBrowser1_DocumentCompleted(ByVal sender As System.Object, ByVal e As System.Windows.Forms.WebBrowserDocumentCompletedEventArgs) Handles WebBrowser1.DocumentCompleted
If i >= RichTextBox1.Lines.Length - 1 Then
i = 0
WebBrowser1.Navigate(RichTextBox1.Lines(i))
Else
i += 1
WebBrowser1.Navigate(RichTextBox1.Lines(i))
End If
End Sub
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
WebBrowser1.Navigate(RichTextBox1.Text)
End Sub
End Class
Now only if you could tell me how to make it wait 5 sec between each link and have it stop after it goes through all the links. Thanks for everyone's help! 🙂
(May 12, 2022 10:16 AM)Goku Wrote: Doesn't change the fact that a human sperm is as human as we are.
(Mar 30, 2014 12:49 PM)Vipеr Wrote: I tried out the code and it worked perfectly, thanks!
Code Public Class Form1
Dim i As Integer = 0
Private Sub WebBrowser1_DocumentCompleted(ByVal sender As System.Object, ByVal e As System.Windows.Forms.WebBrowserDocumentCompletedEventArgs) Handles WebBrowser1.DocumentCompleted
If i >= RichTextBox1.Lines.Length - 1 Then
i = 0
WebBrowser1.Navigate(RichTextBox1.Lines(i))
Else
i += 1
WebBrowser1.Navigate(RichTextBox1.Lines(i))
End If
End Sub
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
WebBrowser1.Navigate(RichTextBox1.Text)
End Sub
End Class
Now only if you could tell me how to make it wait 5 sec between each link and have it stop after it goes through all the links. Thanks for everyone's help! 🙂
Code Public Class Form1
Dim i As Integer = 0
Private Sub WebBrowser1_DocumentCompleted(ByVal sender As System.Object, ByVal e As System.Windows.Forms.WebBrowserDocumentCompletedEventArgs) Handles WebBrowser1.DocumentCompleted
If Not i >= RichTextBox1.Lines.Length - 1 Then
Threading.Thread.Sleep(5000)
i += 1
WebBrowser1.Navigate(RichTextBox1.Lines(i))
End If
End Sub
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
i = 0
WebBrowser1.Navigate(RichTextBox1.Text)
End Sub
End Class
That should work. I think. Still not tested :P
These threads are great. One more stupid idea after another. Use a Queue(Of string you bellends and the documentcompleted event. No timer or sleep ever needed.
a previous example http://www.vbforums.com/showthread.php?7...ost4631607
i do this by declaring a global boolean... set to false.
once the timer reaches 5 seconds i set the boolean to true.
then i use a while loop that exits once i have looped through all the urls. (use a variable "count" to keep track of the number of urls i have visited.)
inside the loop i have a if statement that checks if the boolean is true, (5 min have passed)
if the boolean is true, i navigate too the next site and i increment the "count" variable.
that's all u really need... keep in mind that you cant use the sleep, this will make the program non responsive and the website wont load.
Always make sure the inside your loop you state: "application.doevents;". this will allow the program to load the website even when its in the loop.
hope this helps :)
|