Hier eine (vorerst gaanz) kleine UDF. Werde sie noch weiter ausbauen.
Es macht einen PixelSearch um einen Bereich des Mauszeigers. Die Größe des Bereichs ist nach belieben einstellbar.
Mehr siehe in PSExtended.au3
Changelog: (Aktuelle Version: 1.0.0)
Platzhalter
PSExtended.au3:
Spoiler anzeigen
#include-once
; #FUNCTION# ;===============================================================================
;
; Name...........: _PixelSearchAroundMouse
; Description ...: Searches a rectangle of pixels around the current Mouse-Position for the
; pixel color provided.
; Syntax.........: _PixelSearchAroundMouse($vwidth, $vheight, $vcolor, $vvariation, $vstep)
; Parameters ....: $vwidth = Width of retangle around current Mouse-Position.
; $vheight = Width of retangle around current Mouse-Position.
; $vcolor = Colour value of pixel to find (in decimal or hex).
; $vvariation = [optional] A number between 0 and 255 to indicate the
; allowed number of shades of variation of the red, green, and
; blue components of the colour. Default is 0 (exact match).
; $vstep = [optional] Instead of searching each pixel use a value larger
; than 1 to skip pixels (for speed). E.g. A value of 2 will
; only check every other pixel. Default is 1.
; Return values .: Success: $apspos = A two-element array of pixel's coordinates. ($apspos[0] = x, $apspos[1] = y)
; Failure: Sets @error to 1 if color is not found.
;
; Author ........: Nico Ell (Wambo)
; Modified.......:
; Remarks .......:
; Related .......:
; Link ..........;
; Example .......;
;
; ;==========================================================================================
Func _PixelSearchAroundMouse($vwidth, $vheight, $vcolor, $vvariation = 0, $vstep = 1)
Local $apos[2]
Global $apspos[2]
$apos = MouseGetPos()
$apspos = PixelSearch($apos[0] - $vwidth / 2, $apos[1] - $vheight / 2,$apos[0] + $vwidth / 2,$apos[1] + $vheight / 2, $vcolor, $vvariation, $vstep)
If @error Then
SetError(2)
EndIf
EndFunc
Edit BugFix: Verschoben in Skripte, da ist es passender.