JimIn1985 Posted November 3, 2016 Posted November 3, 2016 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
AutoBert Posted November 3, 2016 Posted November 3, 2016 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.
JimIn1985 Posted November 3, 2016 Author Posted November 3, 2016 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.
JohnOne Posted November 3, 2016 Posted November 3, 2016 Perform a sanity check If $testcolor = PixelGetColor($test[0],$test[1]) Then AutoIt Absolute Beginners Require a serial Pause Script Video Tutorials by Morthawt ipify Monkey's are, like, natures humans.
AutoBert Posted November 3, 2016 Posted November 3, 2016 7 minutes ago, JimIn1985 said: I make sure that the specific pixel has changed color No, you are assigning with $test = MouseGetPos() the coords to array $test. And both times you are using this coords.
JimIn1985 Posted November 3, 2016 Author Posted November 3, 2016 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...
JohnOne Posted November 3, 2016 Posted November 3, 2016 Are you placing mouse at particular position on screen?: could be a dead pixel. AutoIt Absolute Beginners Require a serial Pause Script Video Tutorials by Morthawt ipify Monkey's are, like, natures humans.
JimIn1985 Posted November 3, 2016 Author Posted November 3, 2016 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.
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now