Jump to content

Recommended Posts

Posted

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

 

Posted

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.

Posted

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.

Posted

Yes, I'm using the same co-ordinates, but the pixel in those co-ordinates is definitely changing. I've tries a single equals sign as well, still returns true every time. I'm sure I'm missing something super simple here...

Posted

Well, I'm an idiot. I have another value with a similar name in my script, I mixed them up... Sorry for wasting your time, I was sure that it was a problem with this snippet of code.

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
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...