Jump to content

Recommended Posts

Posted (edited)

I have been trying to figure out how to make the mouse move pixel by pixel. For example, I would like the script to look for a certain color, move the mouse to it then move a specified number of pixels X then a number of pixels Y. Example Script is below.

WinMove( "Window", "", 0,0 ) 

While 1
$Coord = PixelSearch( 778, 179, 801, 409, 0xA9A907, 10 )
   If @Error = 0 Then
      MouseMove( $coord )
      Sleep( 200 )
          MouseMove( A number of pixels X )
          Sleep( 200 )
          MouseMove( A Number of Pixels Y )
          Sleep( 200 )
          MouseClick( "Left" )
   EndIf
          Sleep( 50000 )
Wend

Sorry if my scripting is wrong. Im still new at this.

Thanks in advance

Edited by Jmoore3274
Posted

Store your current mouse coordinates into variables and use them as offsets when you move x or y pixels.

You can also find out the current coordinates of the mouse pointer using MouseGetPos.

Posted

I have been trying to figure out how to make the mouse move pixel by pixel. For example, I would like the script to look for a certain color, move the mouse to it then move a specified number of pixels X then a number of pixels Y. Example Script is below.

WinMove( "Window", "", 0,0 ) 

While 1
$Coord = PixelSearch( 778, 179, 801, 409, 0xA9A907, 10 )
   If @Error = 0 Then
      MouseMove($Coord[0], $Coord[1])
      Sleep( 200 )

          $Coord[0] = $Coord[0] + 50          ; Moves 50 pixels to the right of original x coordinate
          MouseMove($Coord[0], $Coord[1], 0)
          Sleep( 200 )

          $Coord[1] = $Coord[1] + 25          ; Moves 25 pixels up from 50 pixels to the right of the original coordinate
          MouseMove($Coord[0], $Coord[1])
          Sleep( 200 )

          MouseClick( "Left" )
   EndIf
          Sleep( 50000 )
Wend

Sorry if my scripting is wrong. Im still new at this.

Thanks in advance

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
×
×
  • Create New...