jessem Posted June 28, 2006 Posted June 28, 2006 Basically, I need to check for a color in a small PixelSearch box from a x,y location. the whole process is $FindRed = PixelSearch( 100, 50, 1900, 1000, 0xAB3D23 ,10,4) MouseMove($FindRed[0],$FindRed[1],1) ;Look for LimeGreen Color within a small area of where $FindRed is. I tried something like $FindLimeGreen = PixelSearch ($FindRed[0] - 100, $FindRed[1] + 200, $FindRed[0] + 50, $FindRed[1] - 200, 8021856, 5, 4) am I on the right track ? Any suggestions would help a ton , thank you.
PsaltyDS Posted June 28, 2006 Posted June 28, 2006 Basically, I need to check for a color in a small PixelSearch box from a x,y location. the whole process is $FindRed = PixelSearch( 100, 50, 1900, 1000, 0xAB3D23 ,10,4) MouseMove($FindRed[0],$FindRed[1],1) ;Look for LimeGreen Color within a small area of where $FindRed is. I tried something like $FindLimeGreen = PixelSearch ($FindRed[0] - 100, $FindRed[1] + 200, $FindRed[0] + 50, $FindRed[1] - 200, 8021856, 5, 4) am I on the right track ? Any suggestions would help a ton , thank you. Let's assume $FindRed = 600, 400. Your search box for $FindLimeGreen will be 500, 600 at top-left and 650, 200 at bottom right. I haven't tested it, but I suspect that will cause errors. Check out PixelSearch() parameters in the help file. Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law
jessem Posted June 28, 2006 Author Posted June 28, 2006 Recap: Im searching for a red pixel in a large rectangle area. Then once that area is found, find another color in a smaller rectangle area around where the red pixel is.Finding the Red pixel is easy. But the array it returns is x,y. I cant see how to put a small rectangle around that Red Pixel x,y with any success.Ive also tried the following.$c = PixelSearch( 100, 50, 1900, 1000, 0xAB3D23 ,10,4);Gets the X,Y or the Red Pixel. $l = $c[0] - 10 , $c[1] ;left $t = $c[0] , $c[1] - 10 ;top $r = $c[0] + 10 , $c[1] ;right $b = $c[0] , $c[1] + 10 ;bottom $FindGreen = PixelSearch ( $l, $t, $r, $b, 0x6D6A87 ,2,1 ); creates the smaller rectangle based off of ; the found Red Pixel.To me this seams logical. But I'm getting syntax errors on the $l = $c[0] - 10 , $c[1] ;left $t = $c[0] , $c[1] - 10 ;top $r = $c[0] + 10 , $c[1] ;right $b = $c[0] , $c[1] + 10 ;bottomI've poured over the help files many times and searched the forums. anybody have ideas ?
Moderators SmOke_N Posted June 28, 2006 Moderators Posted June 28, 2006 You seemed to be close, try this and see what happens:$c = PixelSearch( 100, 50, 1900, 1000, 0xAB3D23 ,10,4);Gets the X,Y or the Red Pixel. $l = $c[0] - 10 ;top left x $t = $c[1] - 10 ;top left y $r = $c[0] + 10 ;bottom right x $b = $c[1] + 10 ;bottom right y $FindGreen = PixelSearch ( $l, $t, $r, $b, 0x6D6A87 ,2,1 ); creates the smaller rectangle based off of ; the found Red Pixel. Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.
PsaltyDS Posted June 28, 2006 Posted June 28, 2006 Recap: Im searching for a red pixel in a large rectangle area. Then once that area is found, find another color in a smaller rectangle area around where the red pixel is. Finding the Red pixel is easy. But the array it returns is x,y. I cant see how to put a small rectangle around that Red Pixel x,y with any success. Ive also tried the following. $c = PixelSearch( 100, 50, 1900, 1000, 0xAB3D23 ,10,4);Gets the X,Y or the Red Pixel. $l = $c[0] - 10 , $c[1];left $t = $c[0] , $c[1] - 10;top $r = $c[0] + 10 , $c[1];right $b = $c[0] , $c[1] + 10;bottom $FindGreen = PixelSearch ( $l, $t, $r, $b, 0x6D6A87 ,2,1 ); creates the smaller rectangle based off of ; the found Red Pixel. To me this seams logical. But I'm getting syntax errors on the $l = $c[0] - 10 , $c[1];left $t = $c[0] , $c[1] - 10;top $r = $c[0] + 10 , $c[1];right $b = $c[0] , $c[1] + 10;bottom I've poured over the help files many times and searched the forums. anybody have ideas ? My appologies, I seem to have confused the issue for you when I said "Let's assume $FindRed = 600, 400..." That was not a valid reference in AutoIT code. I only meant $FindRed points to x=600, y=400. The value returned is actually an array, so the real references are: $FindRed[0] = 600; This is x $FindRed[1] = 400; This is y So your code above would translate to: $l = $c[0] - 10 ;left $t = $c[1] - 10 ;top $r = $c[0] + 10 ;right $b = $c[1] + 10 ;bottom Sloppy grammer on my part. I hope that clears it up. :"> Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law
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