pedmaster Posted January 25, 2005 Share Posted January 25, 2005 I have used autoit for a short time just messing around and seeing what is possible, and wondering how i could make autoit search for a particular color, then just cause the cursor to click on it. I have looked online and seen: PixelSearch ()- but the parameters never work out for me. So if anyone could just help me out with searching for a color and clicking on it and i would really appreciate it. Thank you Link to comment Share on other sites More sharing options...
falconv Posted January 25, 2005 Share Posted January 25, 2005 show an example of the parameter's you're using in conjunction with PixelSearch() please, then we might be able to help Link to comment Share on other sites More sharing options...
DirtyBanditos Posted January 25, 2005 Share Posted January 25, 2005 I have used autoit for a short time just messing around and seeing what is possible, and wondering how i could make autoit search for a particular color, then just cause the cursor to click on it. I have looked online and seen:PixelSearch ()- but the parameters never work out for me.So if anyone could just help me out with searching for a color and clicking on it and i would really appreciate it.Thank you<{POST_SNAPBACK}>Hi look on your Autoit3 Install folder for the exampel folder and serach for the pixelsearch exampel! good look! Link to comment Share on other sites More sharing options...
pedmaster Posted January 25, 2005 Author Share Posted January 25, 2005 (edited) well i have no idea what to use, so i just put the hexidecimal code in as a guess, but that was an error, and the couple i have seen have it set up with multiple numbers. So i don't know how to make it search for a certain pixel color. btw dirty- i cant find it... Edited January 25, 2005 by pedmaster Link to comment Share on other sites More sharing options...
falconv Posted January 25, 2005 Share Posted January 25, 2005 Here's a quick example, this will search in the area of my recycle bin and double-click the first green pixel it finds: $coord = PixelSearch( 953, 656, 1011, 711, 0x019901 ) MouseClick( "left", $coord[0], $coord[1], 2 ) I get the coordinates of the pixel it finds collected into $coord[0] (x) and $coord[1] (y) (it adds the [0] and [1] automatically), then use those found coordinates in the MouseClick function to tell it where to click. Does that make any sense? Link to comment Share on other sites More sharing options...
pedmaster Posted January 25, 2005 Author Share Posted January 25, 2005 (edited) Yes, but where does '( 953, 656, 1011, 711, 0x019901 )' come from? Nevermind, i think i get it, i dont need to add $coord[0] and [1], as it automatically does that? Thanks for the help! Edited January 26, 2005 by pedmaster Link to comment Share on other sites More sharing options...
falconv Posted January 26, 2005 Share Posted January 26, 2005 (edited) Yes, but where does '( 953, 656, 1011, 711, 0x019901 )'come from?953 is to the left of my recycle bin, 656 is above it, 1011 to the right of it, and 711 below it. These are the coordinates that define the area I want to be searched. The 0x019901 is the hex for the color I wanted it to search for.Sleep (2000)$icolor = 0xDF7419$coord = PixelSearch ( 825, 155, 841, 171, $icolor )Sleep (1000)MouseClick( "right", $coord, $coord, 1I haven't tried this code yet, but right now I can mention that you don't need the [0] or [1] for $coord = PixelSearch, but you DO need it in the coordinates: MouseClick( "right", $coord[0], $coord[1] ). (my apologies for the miscommunication)I changed it to this:Sleep (2000) $icolor = 0xDF7419 $coord = PixelSearch ( 825, 155, 841, 171, $icolor ) Sleep (1000) MouseClick( "right", $coord[0], $coord[1] )and it gave me an error only because it didn't find that color (orange?) within that range (it's off my screen, my resolution isn't that hight ) But try that code and see if it works. Edited January 26, 2005 by falconv Link to comment Share on other sites More sharing options...
pedmaster Posted January 26, 2005 Author Share Posted January 26, 2005 (edited) Yes, thanks again, i have figured out how to get it working. What i can't figure out now is how to make it retry the sequence and search again after there is an error, say it didnt find the pixel. It just brings up the error msg, but I don't want it to, I am hoping to make it retry the pixel search. $Repeat = 0 $icolor = 0xDF7419 While $Repeat <= 10 Sleep (2000) $coord = PixelSearch ( 825, 155, 841, 171, $icolor ) Sleep (1000) MouseClick( "right", $coord[0], $coord[1], 1 ) Sleep (3000) WEnd Edited January 26, 2005 by pedmaster Link to comment Share on other sites More sharing options...
SlimShady Posted January 26, 2005 Share Posted January 26, 2005 $Repeat = 0 $icolor = 0xDF7419 While $Repeat <= 10 Sleep (2000) $coord = PixelSearch ( 825, 155, 841, 171, $icolor ) If NOT @error Then Sleep (1000) MouseClick( "right", $coord[0], $coord[1], 1 ) Sleep (3000) EndIf WEnd Good luck. Link to comment Share on other sites More sharing options...
pedmaster Posted January 26, 2005 Author Share Posted January 26, 2005 Thanks for the help everyone. First time using v3 and its different, plus im a complete newbie when it comes to this, but trying to learn. Link to comment Share on other sites More sharing options...
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