Jump to content
Sign in to follow this  

Mouse path randomizer

Recommended Posts


As my first program, I made a function that will move the mouse from point A to point B in a random path (might be less detectible.) I break up the line into a series of segments, and at each step I add a factor of randomness.

x and y are the final coordinates.

randx and randy are added to each step to produce randomness.

steps is the number of steps to take.

min and max wait define how long it should take to take each step

I tested this in Paint (that is why I am using MouseClick instead of MouseMove) and this function produces a nice randomized path.

Func MouseMoveRandom($x, $y, $randx, $randy, $steps, $minwait, $maxwait)
    Local $curx, $cury, $dx, $dy
    Local $nsteps = $steps
    For $count = 0 to ($nsteps-1)
        $curx = MouseGetPos(0)
        $cury = MouseGetPos(1)
        $dx = ($x - $curx)/$steps
        $dy = ($y - $cury)/$steps
        MouseClick("left",$curx + $dx + Random(-1*$randx,$randx), $cury + $dy+ Random(-1*$randy,$randy), 1, Random($minwait, $maxwait))
        $steps -= 1
    MouseClick("left",$x, $y, 1, Random($minwait, $maxwait))

Share this post

Link to post
Share on other sites

Works good. I like it.

[left][sub]We're trapped in the belly of this horrible machine.[/sub][sup]And the machine is bleeding to death...[/sup][sup][/sup][/left]

Share this post

Link to post
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
Sign in to follow this