Jump to content

Help me figure this out PLEASE


Recommended Posts

I just started Autoit about two weeks ago so I basically don't know squat and that makes this much harder but bare with me if you can.

I want help making a line of script that will tell the mouse to click a random spot within a preset coordinates but then I want it to click a second point that is also random but relative to the first click. In other words, the first click will open up a menu that is always positioned relative to the click, the second click must then also be relative to the first so that it can pick the right option.

This is what I have so far to get the first click, right now it is set up to be continuous as that is what I'll need.

While 1
    $posx = Random(1204, 1230)
    $posy = Random(446, 461)
    MouseMove($posx, $posy)
    MouseClick("primary")
    Sleep(Random(1250, 1600, 1))
WEnd

So after this makes the first click which is random, I want the mouse to move down a little bit and click again. It'd be really great if it could move a random amount down and to the left or right. Thank you to anyone that even attempts to help me.

Link to comment
Share on other sites

I got this to work sort of

While 1
 $posx = Random(629, 732)
 $posy = Random(222, 301)
 MouseMove($posx, $posy)
 MouseClick("secondary")
 Local $aPos = MouseGetPos()
 Sleep(Random(1250, 1600, 1))
 MouseMove($aPos[0] - 20, $aPos[1] + 50)
 MouseClick("primary")
 Sleep(Random(19050, 19600, 1))
WEnd

But I would really like it if the $aPos[0] could be plus or minus any number between 1 and 100 and the $aPos[1]  to be plus any number between 45 and 50.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...