Jump to content

Simple pixelsearch


Recommended Posts

$coord = PixelSearch( 464,306, 468, 306, 0xFFFFFF  ) ; Checks for a white pixel in these coord
If Not @error Then
MsgBox(0, "X and Y are:", $coord[0] & "," & $coord[1])
 
elseif @error
MsgBox(0, "Error found!", "Nothing white here")
Endif

And I can't understand the error I get (probably when it doesn't find a white pixel):

Subscript used with non-Array variable.:

Mousemove($coord[0],$coord[1])

Mousemove($coord^ ERROR

>Exit code: 1 Time: 4.819

Am I making a mistake in [left, top, right, bottom] syntax?Or is it something else?

Thanks in advance

Link to comment
Share on other sites

If PixelSearch doesn't find function returns 0 (not array).

You should use MouseMove in If... EndIf:

$coord = PixelSearch(464, 306, 468, 306, 0xFFFFFF)
If Not @error Then
MouseMove($coord[0], $coord[1])
;Code...
EndIf

Or simpler:

$coord = PixelSearch(464, 306, 468, 306, 0xFFFFFF)
If Not @error Then MouseMove($coord[0], $coord[1])
Edited by Ramzes

Sorry for my bad English but nobody is perfect. [font=arial, helvetica, sans-serif]Ramzes[/font]

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...