Visual Basic Random Move / Click

Currently I have a program that will click in a specific coordinate. What I want to know is if it's possible for vb to randomly move / click in a spot. This is what I have so far, and it works with moving to the (Area). The total area of the object is TopLeft: 115, 734 and BottomRight: 153,763. So if possible can I tell it to move and click anywere from 115,734 & 153, 763. Thanks.

 Dim Area = (New Point(Val(135), Val(747)))

AppActive("Current App Focus Needed I guess")


Open in new window

Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Have look at these, you can take out the timer stuff, or at least easily pick out how they are doing the mouseclick (the basic concept is they send window messages indicatingg various facts about the mouse click):
Jack_JonesAuthor Commented:
So I could do the following then? Was hopeing to make it where I could just say here is a list of x, y coordinates use these at random times.

 Dim Area = (New Point(Val(135), Val(747)))
 Dim Area2 = (New Point(Val(136), Val(748)))
 Dim A As Integer

AppActive("Current App Focus Needed I guess")

If A = 0 Then
            A = A + 1
           ' insert mouse click command
            A = 0
           ' insert mouse click command
        End If

Open in new window

Mike TomlinsonHigh School Computer Science, Computer Applications, and Mathematics TeachersCommented:
You can do something like this:

    MoveMouseToArea(New Point(115, 734), New Point(153, 763))

Using this Sub:
Private Sub MoveMouseToArea(ByVal TopLeft As Point, ByVal BottomRight As Point)
        Static R As New Random
        MoveMouseTo(New Point(R.Next(TopLeft.X, BottomRight.X + 1), R.Next(TopLeft.Y, BottomRight.Y+1))
    End Sub

Open in new window


Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Jack_JonesAuthor Commented:
Awesome man, thanks again your on fire.
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Visual Basic.NET

From novice to tech pro — start learning today.