Taudy Posted June 5, 2011 Posted June 5, 2011 (edited) Edit: found my mistake, i'll probably make a post here when i can't figure out how to make it click there. Hi guys, sorry i'm such a noob at this. anyways I'm trying to do a pixel color search and then convert it to a click at the found pixel I've tried the following code to check for a pixel and it to tell me where it is, but it doesn't seem to find the pixel winactivate ( "webpage - Windows Internet Explorer") sleep(500) pixelsearch (0,0,406,419, 0x6F808A) If Not @error Then MsgBox(0, "X and Y are:", $coord[0] & "," & $coord[1]) EndIf the pixel is located at 405,418 for this simple example, so i know where it is for testing purposes. i placed the top corner above and to the left (top left corner of screen) and the bottom corner just below and to the right. is there something i'm doing wrong? thanks Edited June 5, 2011 by Taudy
hotbuttmud Posted June 5, 2011 Posted June 5, 2011 (edited) The PixelSearch creates an Array type variable, which is actually two separate numbers within it, the X and Y coordinates. $location = PixelSearch(137, 321, 540, 683,0xEEA200, 2, 1) $location becomes equal to the PixelSearch results has the coordinates of the found pixel. Here's a bit on one of the dozens of bots I've made using this concept: $location = PixelSearch (137, 321, 540, 683,0xEEA200, 2, 1) If IsArray ($location) = 1 Then MouseClick ('left', $location[0], $location[1], 1, 0) EndIf $location[0] and $location[1] are X and Y respectively. The "If IsArray" just makes sure $location is an array and contains the X and Y coordinates instead of just one number. Does that clear things up? Edited June 5, 2011 by hotbuttmud
Taudy Posted June 6, 2011 Author Posted June 6, 2011 Thanks for your input, i managed to make a pixel click using the following method, would you say it is less effective than just using a mouseclick? $findpixel3 = PixelSearch(300, 553,1000, 1000,"0xC89468") if IsArray($findpixel3) = True Then MouseMove($findpixel3 [0], $findpixel3 [1],1) MouseClick("left") EndIf EndFunc
FastFrench Posted June 9, 2011 Posted June 9, 2011 It doesn't really matter. Why would you use two instructions when one do the job ?
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