I know this is probably basic but I'm having trouble figuring it out even with excessive amounts of googling...
This is the code I am working with...
The goal is to move cursor over a button in a webbrowser and click it, wait 5 seconds, move cursor over another button, click that button and so on...HTML Code:Private Sub Button12_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button12.Click Me.Cursor.Position = New Point(535, 195) Sleep(500) mouse_event(MOUSEEVENTF_LEFTDOWN, 335, 195, 0, 0) mouse_event(MOUSEEVENTF_LEFTUP, 335, 195, 0, 0) Sleep(5000) Me.Cursor.Position = New Point(390, 195) Sleep(500) mouse_event(MOUSEEVENTF_LEFTDOWN, 390, 195, 0, 0) mouse_event(MOUSEEVENTF_LEFTUP, 390, 195, 0, 0) End Sub
Everything is working, the cursor moves appropriately, the mouse clicks fine, but it doesn't do them sequentially. It does the following...
- Moves mouse to first location (but doesn't click)
- Waits about 7 seconds (not sure why, I would think it would be either 5.5 or 11 seconds...)
- Moves to second mouse location and clicks mouse button twice in a row fast
This is for a program just for me, this is the way I need to perform this, I could program it easily in autoit but would like to do it inside the vb code like this somehow.
What am I doing wrong???
Thanks for any help or points in the right direction!


Reply With Quote