For those interested in what the final solution was, here is the setup.
1 form, 2 labels, 2 timers, 1 webbrowser control
The webbrowser control had its property "URL" set to the website in question. Timer1 and Label1 were there for visual cues to the first part of the login, Timer2 and Label2 again are visual cues for the second part of the automated login. I'm sure there are different ways of doing this, but it works for me. :cheesy:
Webbrowser1 and Timer1/Label1 are running at form load. Label1 shows the TimeofDay, webbrowser1's URL (set in properties) has the login page loaded and waiting. There is no menu/tool strip, just the labels across the top of the form, and the webbrowser control filling the remainder of the form (640x480 in my setup).
When TimeofDay hits the set-time in the first IF/THEN statement, timer1 is shut off BEFORE sending the sendkeys.send("usernamehere") command. Why? Well, in this configuration, it would repeat the "usernamehere" string every time the timer ticked until the textbox was filled. No good. Shutting of the timer before the sendkeys command solved this. A "Tab" command was sent (thanks for the tip iamthwee) to move the cursor focus to the password field, and then the sendkeys command types out the password, the next sendkeys sends an ENTER command to submit the login, as well as activating timer2.
In the Timer2 set, timer2 is shut off once the timeofday in the IF/THEN is reached. (I purposely added a long delay, 2mins 10secs, to account for *any* conceivable delays in page loads). In my situation, the second page has a "confirm" button that needs to be pressed in order to finalize the login, so two Tabs brings focus to the correct button and an ENTER submits the confirmation.
Obviously, the code below will only work for the particular site that I am using, but I'm sure with some experimentation, and counting of "TABS" you can make it work for your use. Enjoy.
PublicClass Form1
Private Sub Form1_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
Timer1.Enabled = True
Timer2.Enabled = False
End Sub
Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick
Label1.Text = TimeOfDay
If TimeOfDay = "5:30:10 PM" Then
Timer1.Enabled = False
SendKeys.Send("usernamehere")
SendKeys.Send("{TAB}")
SendKeys.Send("passwordhere")
SendKeys.Send("{ENTER}")
Timer2.Enabled = True
End If
End Sub
Private Sub Timer2_Tick(ByVal sender As Object, ByVal e As System.EventArgs) Handles Timer2.Tick
Label2.Text = TimeOfDay
If TimeOfDay = "5:32:20 PM" Then
Timer2.Enabled = False
SendKeys.Send("{TAB}")
SendKeys.Send("{TAB}")
SendKeys.Send("{ENTER}")
End If
End Sub
EndClass