Jump to content

Function is always returning 'True', no matter what.


Recommended Posts

I've been trying to fix this all day but I can't even find the problem. I'm trying to get the position and color of a specific pixel, then find out if the pixel is still the same color after a while. I'm going absolutely crazy, I've got other very similar parts of code that work fine in the same script, but for some reason this specific part always returns true. Does this also return true no matter what for you guys or is it just me?

$test = MouseGetPos()
sleep(5000) ; I move my mouse away during this time to avoid its interference with the pixel color
$testcolor = PixelGetColor($test[0],$test[1])
sleep(10000)
If $testcolor == PixelGetColor($test[0],$test[1]) Then
    msgbox(1, "title", "the value is true")
EndIf

 

Link to comment
Share on other sites

It must be true as you are asking both times the same coord. But to automate a app with one of the ugly func's like PixelGetColor is normaly not needed. Most serious apps can be automated by native AutoIt func's or already written UDF's. May be it takes a bit longer to prog, but it runs on same OS-Arch on every pc. So please name the app to get better help.

Link to comment
Share on other sites

Sorry, I should have mentioned that during this part of the code:

sleep(10000)

I make sure that the specific pixel has changed color (I went as far as making my whole screen blue, recorded the pixel color, then made my whole screen red and it still returned true) , I have no idea what I'm doing wrong.

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...