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
Next

MouseClick("left",\$x, \$y, 1, Random(\$minwait, \$maxwait))

EndFunc```

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]

Create an account

Register a new account