kalle437 Posted August 30, 2008 Posted August 30, 2008 (edited) I'm trying to make a script which, when a certain color is displayed on a certain pixel, will click at that pixel. The code i've written looks like this: $var = pixelgetcolor ( 567, 222) while $var <> 0x740300 WEnd MouseClick("left", 567, 222, 1) I've searched around the forums, checked the help files and tried everything I could come up with and still I havn't solved it. I made a separate script which I ran when the color at the pixel already was correct from start, then it worked, but I can not get it to work when the pixel ain't right from the beginning. And i also checked if the vaule of $var changes by making a loop with a popup window to display the value of the pixel, and it changes and eventually that value turns to the one I want. But as soon as I try it in the script I want it to be in, it doesn't work. EDIT: I could also add that the code havn't looked like this all the time, ive tried with all kinds of loops, i had the value i want the pixels to be changed to decimal etc. Help is much appreciated! Edited August 30, 2008 by kalle437
andybiochem Posted August 30, 2008 Posted August 30, 2008 $var = pixelgetcolor ( 567, 222) while $var <> 0x740300 $var = pixelgetcolor ( 567, 222) WEnd MouseClick("left", 567, 222, 1) - Table UDF - create simple data tables - Line Graph UDF GDI+ - quickly create simple line graphs with x and y axes (uses GDI+ with double buffer) - Line Graph UDF - quickly create simple line graphs with x and y axes (uses AI native graphic control) - Barcode Generator Code 128 B C - Create the 1/0 code for barcodes. - WebCam as BarCode Reader - use your webcam to read barcodes - Stereograms!!! - make your own stereograms in AutoIT - Ziggurat Gaussian Distribution RNG - generate random numbers based on normal/gaussian distribution - Box-Muller Gaussian Distribution RNG - generate random numbers based on normal/gaussian distribution - Elastic Radio Buttons - faux-gravity effects in AutoIT (from javascript)- Morse Code Generator - Generate morse code by tapping your spacebar!
Andreik Posted August 30, 2008 Posted August 30, 2008 (edited) PixelGetColor returns decimal value of pixel's color and you use a hex value to compare. Try use this: While "0x" & Hex($var,6) <> "0x740300" Edited August 30, 2008 by Andreik
kalle437 Posted August 30, 2008 Author Posted August 30, 2008 I implemented what both of you had written, and now it works Thanks a lot for the quick answers!
Andreik Posted August 30, 2008 Posted August 30, 2008 I implemented what both of you had written, and now it works Thanks a lot for the quick answers!Welcome to AutoIt Forum.
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