Jump to content
Sign in to follow this  

Have to Uninstall/Reinstall, or PixelSearch Gives False Positives?

Recommended Posts

This drove me nutty for a full day. I'm a somewhat amateur coder, but usually I can find and correct my mistakes without too much difficulty.

But here.. I was having a lot of difficulty with PixelSearch; it would be working just fine for a while, but then suddenly some uses of it started giving a false positive every single time. Finally I came across.. something of a solution: If I uninstalled + reinstalled AutoIt, everything would work again. For a little while. Then I'd have to do it again.

Just using various forms of this, mostly watching progress bars and so on:

Func CheckProgress()

$coord = PixelSearch( 301, 69, 93, 69, 0xFF0000 )
  If Not @error Then
   $progress = round(((207 - (300 - $coord[0])) / 207) * 100);
   MsgBox(0,"ERROR", "Error! Can't find the progress bar!")


The code is pretty much right from the PixelSearch example code, so I can't imagine there being any problem with it - but there it is just in case.

That snippet is for a red (decreasing) progress bar. If PixelSearch doesn't see any red (indicating I haven't maximized the appropriate window and the bar isn't where it should be) it should popup an error window. My script used several functions like this, altered only for location and sometimes the color of the bar.

Would work for a while.. then one of them - and strangely, not all of them - would incorrectly report a color match on the first pixel searched, as when I resized the window or ran the script without the appropriate window opened at all to make sure the error-checking worked. When it started doing this, I even added a PixelGetColor for e.g. 301, 69 to run right before the PixelSearch function. PixelGetColor would tell me 301,69 is blue; immediately after, PixelSearch reports a match on 301, 69 with red. Once this started, it was the same thing every time.

I'm Using Win7 x64. Same problem whether running the AutoIt script as x64 or x86, and same problem on my laptop and my desktop. Script works a while, then the false positives. No editing of the script at all at this point, just running it. Uninstall/reinstall, works for a few runs, then back to the false positives.

Any ideas at all on this?

Share this post

Link to post
Share on other sites

additional info:

Still no luck in figuring this one out. Same problem even when I compile the script to an .exe (either as x64 or x86), which seems kind of strange to me..

I'm out of my depth here, but it seems like maybe something is 'sticking' in memory after a while, leading to the false color match on pixels that used to be the correct color but are not currently, and the uninstall/reinstall flushes that.

If only I had some idea of what is sticking, maybe there's some code I could add to clear it.

Share this post

Link to post
Share on other sites

Im pretty sure im having the same problem, haven't done as much testing yet, but still working on it.

Thought you might find that interesting, ha .p

please post if you find a solution to the false positives ;)

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  

  • Recently Browsing   0 members

    No registered users viewing this page.

  • Create New...