Looping Website Viewer?
-
Say I wanted to create a small program that automatically rotated between websites every X seconds, where would I need to start? For instance, I create a simple form, it has 2 buttons. A start and a stop button. The stop button just quits the program completely, so I'm using the Me.Close() function for that, so I'm not worried about that. However, I want the start button to do something like.....open Google in Internet Explorer, and after say...45 seconds, rotate to Yahoo, and then another 45 seconds, rotate to MSN, and so forth and so on. Now, say I wanted the rotations to be less than 2 minutes, but more than 30 seconds, where would I start there? Would I use the Do/Loop functions?
-
Say I wanted to create a small program that automatically rotated between websites every X seconds, where would I need to start? For instance, I create a simple form, it has 2 buttons. A start and a stop button. The stop button just quits the program completely, so I'm using the Me.Close() function for that, so I'm not worried about that. However, I want the start button to do something like.....open Google in Internet Explorer, and after say...45 seconds, rotate to Yahoo, and then another 45 seconds, rotate to MSN, and so forth and so on. Now, say I wanted the rotations to be less than 2 minutes, but more than 30 seconds, where would I start there? Would I use the Do/Loop functions?
This is trivial. Just use a timer.
Christian Graus Driven to the arms of OSX by Vista. Read my blog to find out how I've worked around bugs in Microsoft tools and frameworks.
-
This is trivial. Just use a timer.
Christian Graus Driven to the arms of OSX by Vista. Read my blog to find out how I've worked around bugs in Microsoft tools and frameworks.
So glad this is trivial to an expert like yourself. However, being a beginner, the question still begs to differ. So, I go to using a timer, that's fine, but where do I begin? How do I launch the websites and make them rotate? Which function do I do? Obviously it won't be a Do- function. Where would you suggest I start? And since it's trivial, let's do it this way. I want to make the timers connect to and then jump through using proxy. I.E., when the program is first launched, I want it to connect to a predefined proxy server and run through all the websites one time. Then on it's return path (or loop if you will), I want it to connect to a second predefined proxy server and have it run through the websites like that, so forth and so on. Any suggestions for that?
-
So glad this is trivial to an expert like yourself. However, being a beginner, the question still begs to differ. So, I go to using a timer, that's fine, but where do I begin? How do I launch the websites and make them rotate? Which function do I do? Obviously it won't be a Do- function. Where would you suggest I start? And since it's trivial, let's do it this way. I want to make the timers connect to and then jump through using proxy. I.E., when the program is first launched, I want it to connect to a predefined proxy server and run through all the websites one time. Then on it's return path (or loop if you will), I want it to connect to a second predefined proxy server and have it run through the websites like that, so forth and so on. Any suggestions for that?
Have a list of the sites you want to visit in an arraylist, have an integer that will increment from 0 to arraylist.count-1, then put on a timer and set the interval to 45 seconds, then on the timers .tick event navigate to the url stored in arraylist(integer you are incrementing), increment integer. I will try to post some code when i get the chance
-
Have a list of the sites you want to visit in an arraylist, have an integer that will increment from 0 to arraylist.count-1, then put on a timer and set the interval to 45 seconds, then on the timers .tick event navigate to the url stored in arraylist(integer you are incrementing), increment integer. I will try to post some code when i get the chance
Ok so i got the code done quickly :) Add a webbrowser control, a timer, and a button. Set the timer at the interval you want. If you want a stop button, just add one with Me.Timer1.Stop, thats it.
Public Class Form1
Dim siteCount As Integer = 0
Dim aList As New ArrayList
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
aList.Add("http://www.jmbundy.blogspot.com/")
aList.Add("http://www.codeproject.com/Messages/3244826/Re-Looping-Website-Viewer.aspx")
aList.Add("http://www.google.com/webhp?sourceid=navclient&ie=UTF-8")
End Sub
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Me.Timer1.Start()
End Sub
Private Sub Timer1_Tick(ByVal sender As Object, ByVal e As System.EventArgs) Handles Timer1.Tick
Me.WebBrowser1.Navigate(Me.aList(siteCount))
If siteCount + 1 <= Me.aList.Count - 1 Then
siteCount += 1
Else : siteCount = 0
End If
End Sub
End Class -
Ok so i got the code done quickly :) Add a webbrowser control, a timer, and a button. Set the timer at the interval you want. If you want a stop button, just add one with Me.Timer1.Stop, thats it.
Public Class Form1
Dim siteCount As Integer = 0
Dim aList As New ArrayList
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
aList.Add("http://www.jmbundy.blogspot.com/")
aList.Add("http://www.codeproject.com/Messages/3244826/Re-Looping-Website-Viewer.aspx")
aList.Add("http://www.google.com/webhp?sourceid=navclient&ie=UTF-8")
End Sub
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Me.Timer1.Start()
End Sub
Private Sub Timer1_Tick(ByVal sender As Object, ByVal e As System.EventArgs) Handles Timer1.Tick
Me.WebBrowser1.Navigate(Me.aList(siteCount))
If siteCount + 1 <= Me.aList.Count - 1 Then
siteCount += 1
Else : siteCount = 0
End If
End Sub
End ClassThis is a wonderful solution and is greatly appreciated. Now all I have to do is figure out how to make it jump through proxies. I'm wondering, could I use the GetStream() function to try and make it jump through proxies?
-
This is a wonderful solution and is greatly appreciated. Now all I have to do is figure out how to make it jump through proxies. I'm wondering, could I use the GetStream() function to try and make it jump through proxies?
Not sure, never tried but look at this link, has code included. http://www.dreamincode.net/forums/showtopic53244.htm[^]
-
Not sure, never tried but look at this link, has code included. http://www.dreamincode.net/forums/showtopic53244.htm[^]
John, really great resources for reviewing! Thanks so much!