Jump to content

Looping the PixelSearch command?


 Share

Recommended Posts

Alright, so my problem is basically that I want the program to constantly check to see if there's a specific color in a certain spot and then send a command if that color is present. Unfortunately, I can't tell if it's looping, or if it simply checks once and then gives up. I'm guessing the latter.

WinWaitActive( "firefox" )
$coord = PixelSearch( 145, 593, 292, 448, 006699, 10)
If Not @error Then
    MsgBox(0, "X and Y are:", $coord[0] & "," & $coord[1])
EndIf

As far as I can tell, if the color is there when the window opens it'll give me a dialogue of where it first detected the color. What I need it to do is to constantly check that space for the color and then "Send ("{TAB}")" which I haven't tried because I can't get my debug mode (the above snippet) working.

Any help or advice would be appreciated.

Edited by Lanphrost
Link to comment
Share on other sites

if you want to loop until it finds the pixel.

WinWaitActive("firefox")
While 1
    $coord = PixelSearch(145, 593, 292, 448, 006699)
    If Not @error Then
        MsgBox(0, "X and Y are:", $coord[0] & "," & $coord[1])
        Exit
    EndIf
    Sleep(10)
WEnd

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

Monkey's are, like, natures humans.

Link to comment
Share on other sites

Alright, the color seems to be off, but I can't figure out which color it is, and I want it to loop even after it's found the color, is that possible?

Edit 2:

Got the thing to loop, removing 'exit' was easy enough. Now I just need to figure out what color it is that I'm looking for.

Edited by Lanphrost
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...