ofLight Posted August 27, 2007 Posted August 27, 2007 (edited) Search for all instances of a CheckSum and return Total and all of thier CoOrds. Im sure there are many versions of this, but here is my attempt. PixelCheckSumFindAll.au3expandcollapse popup;=============================================================================== ; Function Name: _PixelCheckSumFindAll ; Description: Finds all instances of Checksum within a given area and returns array with Total and all locations X and Y. ; Parameters: $Pixel Colour value of pixel to find (in decimal or hex). ; $chksum Previously generated checksum value of the region per(PixelChecksum) ; $CS_l left coordinate of rectangle. (amount to subtract) ; $CS_t Top coordinate of rectangle. (amount to subtract) ; $CS_r Right coordinate of rectangle. (amount to add) ; $CS_b Bottom coordinate of rectangle. (amount to add) ; $SB_l left coordinate of total area to search. Default is 0 (far left side of screen) ; $SB_t top coordinate of total area to search. Default is 0 (top most Side of screen) ; $SB_r Right coordinate of total area to search. Default is @DesktopWidth (Far Right side of screen) ; $SB_b Bottom coordinate of total area to search. Default is @DesktopHeight (Bottom most side of screen) ; Syntax: _PixelCheckSumFindAll($pixel, $chksum, $CS_l, $CS_t, $CS_r, $CS_b[, $SB_l, $SB_t, $SB_r, $SB_b]) ; Author(s): ofLight ; Returns: $Array[0][0] = 0 on failure, $Array on success ;=============================================================================== Func _PixelCheckSumFindAll($pixel,$chksum,$CS_l,$CS_t,$CS_r,$CS_b,$SB_l=0,$SB_t=0,$SB_r=@DesktopWidth,$SB_b=@DesktopHeight) $SB_b_Max = $SB_b $SB_l_Max = $SB_l Dim $Array[2][2] $Array[0][0] = "0" $Count = "0" While 1 $xy = PixelSearch($SB_l,$SB_t,$SB_r,$SB_b,$pixel, 0) If @error And $SB_b = $SB_b_Max Then SetError(1) Return $Array ElseIf @error Then $SB_t = $SB_b + 1 $SB_b = $SB_b_Max $SB_l = $SB_l_Max ElseIf $chksum = PixelCheckSum($xy[0]-$CS_l, $xy[1]-$CS_t, $xy[0]+$CS_r, $xy[1]+$CS_B) Then $Count = $Count+1 $Array[0][0] = $Count ReDim $Array[$Count+1][2] $Array[$Count][0] = $xy[0] $Array[$Count][1] = $xy[1] $SB_t = $xy[1] $SB_b = $SB_t $SB_l = $xy[0] + 1 Else $SB_t = $xy[1] $SB_b = $SB_t $SB_l = $xy[0] + 1 EndIf WEnd EndFuncoÝ÷ ØLZ^RǺÚ"µÍÚ[ÛYH Ø^K]LÉÝÂÚ[ÛYH Ô^[ÚXÚÔÝ[Q[[]LÉÝÂÝÙ^TÙ] ][ÝÉÎMÉ][ÝË ][Ý×ÑÛÉ][ÝÊBÝÙ^TÙ] ][Ýß][ÝË ][Ý×ÜXÛÜ ][ÝÊBÝÙ^TÙ] ÌÎNÞÙØßIÌÎNË ÌÎN×Ñ^] ÌÎNÊBØØ[ ÌÍÛÙÈHI][ÝÔÜÈÚY Ý[HÈXÛÜ ][ÝÈ [È [ÈÂBBBI][ÝÔÜÈ[HÈ[ ][ÝÈ [È [ÈÂBBBI][ÝÚ[ÈØ]Y[^[[I][ÝÈØØ[ ÌÍÞK ÌÍØÝ[^[Ú[HBIÌÍÞHH[ÝÙQÙ]ÜÊ BIÌÍØÝ[^[H^[Ù]ÛÛÜ ÌÍÞVÌK ÌÍÞVÌWJBUÛÛ ][ÝÔ^[ÛÛÜH ][ÝÈ [È ÌÍØÝ[^[ [È [È ÌÍÛÙÊBTÛY L BÑ[[ÈÑÛÊ BIÌÍÜ^[H[ [TXY ][ÝËÌLÔ^[[I][ÝË ][ÝÓXZ[][ÝË ][ÝÔ^[ÛÛÜ][ÝË ][ÝËLI][ÝÊJBIÌÍØÚÜÝ[HH[ [TXY ][ÝËÌLÔ^[[I][ÝË ][ÝÓXZ[][ÝË ][ÝÔ^[ÚXÚÔÝ[I][ÝË ][ÝËLI][ÝÊJBIÌÍÐ^HHÔ^[ÚXÚÔÝ[Q[[ ÌÍÜ^[ ÌÍØÚÜÝ[K K K K JBWÐ^QÜ^J ÌÍÐ^JB[[Â[ÈÜXÛÜ BR[UÜ]J ][ÝËÌLÔ^[[I][ÝË ][ÝÓXZ[][ÝË ][ÝÔ^[ÛÛÜ][ÝË ÌÍØÝ[^[ BSØØ[ ÌÍØÚÜÝ[HH^[ÚXÚÜÝ[J ÌÍÞVÌKMK ÌÍÞVÌWKMK ÌÍÞVÌJÍK ÌÍÞVÌWJÍJBR[UÜ]J ][ÝËÌLÔ^[[I][ÝË ][ÝÓXZ[][ÝË ][ÝÔ^[ÚXÚÔÝ[I][ÝË ÌÍØÚÜÝ[JBUÛÛ ÌÎNÈ ÌÎNÉ[ÐÔ[ÉÌÎNÈÐUQ ÌÎNÉ[ÐÔ[ÉÌÎNÈ ÌÎNÊBTÛY L B[[Â[ÈÑ^] BUÛÛ ÌÎNÈ ÌÎNÉ[ÐÔ[ÉÌÎNÈVUSÈ ÌÎNÉ[ÐÔ[ÉÌÎNÈ ÌÎNÊBTÛY L BQ^][[ Edited August 27, 2007 by ofLight There is always a butthead in the crowd, no matter how hard one tries to keep them out.......Volly
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