Jump to content
Sign in to follow this  
inter

Odd PixelSearch Behavior

Recommended Posts

inter

I've just recently begun using Auto It for automation and have run into a strange problem with PixelSearch that I can't seem to figure out.

I'm trying to navigate through my cable box menus as can be seen in my example image.

My approach has been simple, PixelSearch on the left side of the menu listing for the yellow color when a menu is highlighted. Starting at menu 1, it this color is found I send a keystroke to navigate right to menu 2, if the color isn't found I send a keystroke down and then left to navigate to menu 3. This works for me until I reach menu 7 and then the MenuRight function is repeated so that menus 8 and 10 are never highlighted. Once it reaches the next page the script continues to work correctly again until it reaches menu 7 and the process repeats itself.

Am I doing something incorrectly or is there another approach I can take to achieve what I want? Thanks in advance for any help provided.

While 1
    $coord = PixelSearch( 108, 261, 361, 428, 0xBBCC7E, 20 )
    If @error = 0 Then
        MenuLeft()
        Sleep (3000)
    ElseIf @error = 1 Then
        MenuRight()
        Sleep (3000)
    EndIf
WEnd

Func MenuLeft()
    Send("{Right}")
EndFunc

Func MenuRight()
    Send("{Down}")
    Sleep (1500)
    Send("{Left}")
EndFunc

Share this post


Link to post
Share on other sites
Tvern

The most obvious reason would be that your pixelsearch coordinates are incorrect.

Possibly because you've used the pixel coordinates relative to the control, rather than absolute screen coordinate.

Double check those coordinates, if you can't find an error in them, just set the bottom coordinate much higher and test again.

If that gets it working you can schrink the search area to the smallest size as possible for performance. (1 pixel wide should be enough)

Share this post


Link to post
Share on other sites
JohnOne

Assuming your co-ordiates are correct, there are more colours in that yellow area than the one you are looking for.

So perhaps you should lower the step of the pixels you are skipping.


AutoIt Absolute Beginners    Require a serial    Pause Script    Video Tutorials by Morthawt   ipify 

Monkey's are, like, natures humans.

Share this post


Link to post
Share on other sites
inter

Possibly because you've used the pixel coordinates relative to the control, rather than absolute screen coordinate.

It seems that this was the problem (though I swore I checked and double checked) and after fixing the coordinates things appear to be working. Many thanks! :graduated: Edited by inter

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  

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.