Sign in to follow this  
Followers 0
narayanjr

pixelsearch error

4 posts in this topic

$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

Share this post


Link to post
Share on other sites



#2 ·  Posted (edited)

Your code snippet seems to be OK.

So problem is somewhere outside.

Post your whole script.

EDIT:

And what exactly error message say?

Edited by Zedna

Share this post


Link to post
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

Share this post


Link to post
Share on other sites

#4 ·  Posted (edited)

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

Share this post


Link to post
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
Sign in to follow this  
Followers 0