Jump to content

random mouse movement


Recommended Posts

Is there a way to move the mouse inside of 2 coordinates from top left to bottom right and end up inside this box randomly?

ill show you im working on for example:

HotKeySet("{HOME}", "GStart")
HotKeySet("{PAUSE}", "Gpause")
HotKeySet("{ESC}", "Gexit")

while 1
    sleep(100)
WEnd

Func Gstart()
While 1
    sleep(300)
PixelSearch(476,189,513,196,0xE03131,25)
    If not @error Then
    MouseMove(499,260)
EndIf 
if PixelGetColor(476,189) = 16777215 then 
      Gmoveback()
  EndIf
Wend
Endfunc
 
Func Gmoveback()
While 1
 MouseMove(506,239)
 sleep(300)
$var = 1
if $var = 1 then
    Gstart()
     EndIf
Wend
Endfunc

Func Gpause()
While 1
   sleep(100)
Wend
Endfunc

Func Gexit()
    MsgBox(0, "exit box", "Script exited")
    Exit 0
EndFunc

Instead of MouseMove(499,260), move mouse to anywheres inside {topleft (475,239), bottom right(569,249)} but, randomly...

I would like to do this for MouseMove(506,239) too inside a area randomly...

How do i do this?

Link to comment
Share on other sites

*** Not Tested***

HotKeySet("{HOME}", "GStart")
HotKeySet("{PAUSE}", "Gpause")
HotKeySet("{ESC}", "Gexit")

While 1
    Sleep(100)
WEnd

Func Gstart()
    While 1
        Sleep(300)
        PixelSearch(476, 189, 513, 196, 0xE03131, 25)
        If Not @error Then
            MouseMove(499, 260)
        EndIf
        If PixelGetColor(476, 189) = 16777215 Then
            Gmoveback()
        EndIf
    WEnd
EndFunc   ;==>Gstart

Func Gmoveback()
    While 1
        $x = Random(475, 569, 1)
        $y = Random(239, 249, 1)
        MouseMove($x, $y)
        Sleep(300)
        $var = 1
        If $var = 1 Then
            Gstart()
        EndIf
    WEnd
EndFunc   ;==>Gmoveback

Func Gpause()
    While 1
        Sleep(100)
    WEnd
EndFunc   ;==>Gpause

Func Gexit()
    MsgBox(0, "exit box", "Script exited")
    Exit 0
EndFunc   ;==>Gexit

8)

NEWHeader1.png

Link to comment
Share on other sites

*** Not Tested***

HotKeySet("{HOME}", "GStart")
HotKeySet("{PAUSE}", "Gpause")
HotKeySet("{ESC}", "Gexit")

While 1
    Sleep(100)
WEnd

Func Gstart()
    While 1
        Sleep(300)
        PixelSearch(476, 189, 513, 196, 0xE03131, 25)
        If Not @error Then
            MouseMove(499, 260)
        EndIf
        If PixelGetColor(476, 189) = 16777215 Then
            Gmoveback()
        EndIf
    WEnd
EndFunc   ;==>Gstart

Func Gmoveback()
    While 1
        $x = Random(475, 569, 1)
        $y = Random(239, 249, 1)
        MouseMove($x, $y)
        Sleep(300)
        $var = 1
        If $var = 1 Then
            Gstart()
        EndIf
    WEnd
EndFunc   ;==>Gmoveback

Func Gpause()
    While 1
        Sleep(100)
    WEnd
EndFunc   ;==>Gpause

Func Gexit()
    MsgBox(0, "exit box", "Script exited")
    Exit 0
EndFunc   ;==>Gexit

8)

Thanks worked good. now looking how to make the mouse movements more natural with curves not straight lines from point a to point b.
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...