qwertylol Posted May 3, 2007 Posted May 3, 2007 Func search_for_this_color ( ;screen width, screen height, color ) Local $x = 0 Local $y = 0 Do Do If PixelGetColor ( x, y ) = color return (x, y) $y = $y + 1 Until $y = height $y = 0 $x = $x + 1 Until $x = $width Return ( " no such color has been found" ) EndFunc I am using this func to find out if there is a point on the screen with the color I want, and then it will return the (x, y) how do I define an area or more on the screen where I do no want the search to be performed?
Paulie Posted May 3, 2007 Posted May 3, 2007 Have you never seen PixelSearch It does about the same thing you are doing now.
qwertylol Posted May 3, 2007 Author Posted May 3, 2007 Dim $color = 14018275 search_for_this_color ( @DesktopWidth, @DesktopHeight, $color ) Func search_for_this_color ( @DesktopWidth, @DesktopHeight, $color ) Local $x = 0 Local $y = @DesktopHeight Do Do If PixelGetColor ( $x, $y ) = $color return ($x & $y) $y = $y - 1 Until $y = 0 $y = @DesktopHeight $x = $x + 1 Until $x = @DesktopWidth Return ( " no such color has been found" ) EndFunc how do I write the variables to accept multiple returned variables?
qwertylol Posted May 3, 2007 Author Posted May 3, 2007 Have you never seen PixelSearch It does about the same thing you are doing now.I need to search bottom to top
PsaltyDS Posted May 3, 2007 Posted May 3, 2007 (edited) how do I write the variables to accept multiple returned variables? Usually by either using an array, or by assembling a string with a delimiter, like "|". P.S. Look at how PixelSearch() returns its values: Return Value Success: Returns a two-element array of pixel's coordinates. (Array[0] = x, Array[1] = y) Edited May 3, 2007 by PsaltyDS 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
qwertylol Posted May 3, 2007 Author Posted May 3, 2007 actually, what I meant is in the search for this color function above, it's return ($x & $y) how do I write this properly? $variable = search_for_this_color ( @DesktopWidth, @DesktopHeight, $color )
PsaltyDS Posted May 3, 2007 Posted May 3, 2007 actually, what I meant is in the search for this color function above, it's return ($x & $y) how do I write this properly? $variable = search_for_this_color ( @DesktopWidth, @DesktopHeight, $color ) Arrays are your friends. Say it with me: "Arrays are our friends". Func search_for_this_color(@DesktopWidth, @DesktopHeight, $color) ; $avRET[0] = X, $avRET[1] = Y Local $avRET[2] = [0, @DesktopHeight] Do Do If PixelGetColor($x, $y) = $color Then Return $avRET $avRET[1] -= 1 Until $avRET[1] = 0 $avRET[1] = @DesktopHeight $avRET[0] += 1 Until $avRET[0] = @DesktopWidth Return SetError(1, 0, -1) EndFunc ;==>search_for_this_color 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