Jump to content

Mouse path randomizer


bk8
 Share

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
    Next
    
    MouseClick("left",$x, $y, 1, Random($minwait, $maxwait))
    
    EndFunc
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...