Jump to content

pixelsearch error


Recommended Posts

$coord = PixelSearch( 400, 300, 710, 435, 3749945, 50 )

If Not @error Then

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

sleep(100)

MouseClick("left")

Sleep(100)

MouseMove (300, 250, 1)

Sleep(120)

MouseClick("left")

EndIf

it works fine if it fines the object but if it cant find it then i get an error msg

how do i make it ignore the fact that it couldnt find it?

Thanks

Link to comment
Share on other sites

sleep(5000)
; Script Start - Add your code below here
opt("PixelCoordMode", 2)
opt("MouseCoordMode", 2)
opt("ColorMode", 1)


;$var = PixelGetColor( 665 , 417 )
;MsgBox(0,"The decmial color is", $var)
;MsgBox(0,"The hex color is", Hex($var, 6))

$coord = PixelSearch( 400, 300, 710, 435, 3749945, 50 )
    
If Not @error Then
    MouseMove ($coord[0] , $coord[1],1)
    sleep(100)
    MouseClick("left")
    Sleep(100)
    MouseMove (300,  250, 1)
    Sleep(120)
    MouseClick("left")
EndIf

well thats all and i just tried it again and it totally stopped working then i just undid it until the last time time i new it work and now it works fine for some reason but thanks for trying to help

Link to comment
Share on other sites

I think the fix for the error that you might not have noticed you put in after the pixelsearch function, which doesn't create an error if no pixel is found (it just moves to the next piece of code), is:

$coord = PixelSearch( 400, 300, 710, 435, 3749945, 50 )
If not @error  Then
     ;Code here if pixel is found
EndIf

;Code here if pixel not found
Edited by acidfear
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...