Zer0Velocity 0 Posted August 16, 2010 I'm trying to use ofLight pixelfindall script and noticed it don't show how to use Hwnd. Could anyone please explain how I can use a Hwnd with this. expandcollapse popup;================================= PixelFindAll ============================== ; Function Name: _PixelFindAll ; Description: Finds all instances of a pixel within a given area and returns array with Total and all locations X and Y. ; Allows you to limit results by skiping pixels within a given distance to each other. ; Requires: None ; Parameters: $Pixel Colour value of pixel to find (in decimal or hex). ; $XDist Horizontal distance from found pixel to skip before continueing search (moving right) ; $YDist Vertical distance from found pixel to skip before continueing search (moving down) ; $sv Shade Varience ; $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: _PixelFindAll($pixel[, $XDist, $YDist, $sv, $SB_l, $SB_t, $SB_r, $SB_b]) ; Author(s): ; Returns: $Array[0][0] = 0 on failure ;=============================================================================== Func _PixelFindAll($pixel,$XDist=0,$YDist=0,$sv=0,$SB_l=0,$SB_t=0,$SB_r=@DesktopWidth,$SB_b=@DesktopHeight) Dim $Array[2][2], $Count = "0", $SB_l_Max = $SB_l, $SB_b_Max = $SB_b $Array[0][0] = "0" While 1 $xy = PixelSearch($SB_l,$SB_t,$SB_r,$SB_b,$pixel,$sv) If @error And $SB_b = $SB_b_Max Then SetError(1) Dim $Array2[2][2] $Array2[0][0] = "0" $Count = "0" For $i = 1 to $Array[0][0] $Write = 1 For $j = $i+1 to $Array[0][0] $VarX = _CompareNumbers($Array[$i][0], $Array[$j][0], $XDist) If $VarX = 0 Then $VarY = _CompareNumbers($Array[$i][1], $Array[$j][1], $YDist) If $VarY = 0 Then $Write = 0 EndIf Next If $Write = 1 Then $Count = $Count+1 $Array2[0][0] = $Count ReDim $Array2[$Count+1][2] $Array2[$Count][0] = $Array[$i][0] $Array2[$Count][1] = $Array[$i][1] EndIf Next Return $Array2 ElseIf @error Then $SB_t = $SB_b + 1 $SB_b = $SB_b_Max $SB_l = $SB_l_Max Else $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+$YDist EndIf WEnd EndFunc;========================== PixelFindAll =============================== Func _CompareNumbers($Number1, $Number2, $byhowmuch);SUB Function of PixelFindAll ;Verify that $Number1 is more than $byhowmuch from $Number2 ;Returns 0 if within $byhowmuch If $Number1 = $Number2 Then Return 0 ElseIf $Number1 > $Number2 Then If ($Number1-$byhowmuch) >= $Number2 Then Return 1 ElseIf $Number1 < $Number2 Then If ($Number1+$byhowmuch) <= $Number2 Then Return 1 EndIf Return 0 EndFunc Share this post Link to post Share on other sites