How do I make so that the program clicks on certain location based off of x and y coordinates that I tell it to click on? Right now I have:
But when it executes it clicks wherever my mouse is, regardless of what x and y coordinates I pass into it.
Here's the exact code:
dt2 is a datatable
Code:
mouse_event(MOUSEEVENTF_LEFTUP, x, y, 0, 1)
Here's the exact code:
Code:
For n = 0 To dt2.Rows.Count - 1
command = dt2.Rows(n)("Command")
pos = dt2.Rows(n)("Position")
x = Mid(pos, 21, 4)
y = Mid(pos, 28, 3)
Try
If command = "" Then
End If
If command = "Double Click" Then
mouse_event(MOUSEEVENTF_LEFTUP, x, y, 0, 1)
mouse_event(MOUSEEVENTF_RIGHTUP, x, y, 0, 1)
End If
If command = "Left Click" Then
mouse_event(MOUSEEVENTF_LEFTDOWN, x, y, 0, 1)
End If
If command = "Right Click" Then
mouse_event(MOUSEEVENTF_RIGHTDOWN, x, y, 0, 1)
End If
Catch ex As Exception
MsgBox(ex.Message)
End Try
Next
dt2 is a datatable