quixote79
Members-
Posts
15 -
Joined
-
Last visited
Profile Information
-
Location
South Korea
quixote79's Achievements
Seeker (1/7)
0
Reputation
-
Func _PixelSearchinCircle($centerX, $centerY, $radius, $color, $shadevariation = 0, $step = 1) If ($centerX - $radius < 0) or ($centerY - $radius < 0) or ($centerX + $radius > @DesktopWidth) or ($centerY + $radius > @DesktopHeight) Then SetError(2) Else Local $xs[ ($radius + 1) * 2], $xe[ ($radius + 1) * 2] For $i = -$radius To $radius Step 1 $xs[$i + $radius] = Round($centerX - Sqrt($radius ^ 2 - $i ^ 2)) $xe[$i + $radius] = Round($centerX + Sqrt($radius ^ 2 - $i ^ 2)) $point = PixelSearch($xs[$i + $radius], $centerY + $i, $xe[$i + $radius], $centerY + $i, $color, $shadevariation, $step) If Not @error Then Return $point ExitLoop EndIf Next EndIf EndFunc ;==>_PixelSearchinCircle Syntax is same to PixelSearch(), but if range is invalid, it returns @error=2. Tell me if you find any problem, plz. ^^
-
Sorry for my short thinking. Maybe I want to see many many many replies.^^;
-
Thank you. You are only one who is interested in this function. Areavalue has 12 char length per 1 point. I think it is too long. And this function works only under Opt("MouseCoordMode", 1) and Opt("PixelCoordMode", 1). I want someone's suggestion that makes this function more regular and compatible. Thanks.
-
There are some modifications on source.. plz check. 1. You can make a 'Areavalue' in 'Create Areavalue' tab. And by pressing F5 one or more times at different place, you can add plural pixel info to Areavalue. 2. Next, it's time to confirm the function. 3. Once making areavalue, copy it and paste it to '* Areavalue' editbox in 'Find point with Areavalue' tab. 4. Click 'Find' button. 5. If mouse cursor moves to destination, it is a success.
-
I can't find out how to give indent.. Original Source is properly arranged.
-
This is demo. It can be replacement of pixelsearch(). _PixelsSearch() can find pixel by not just 1 pixel info. _PixelsSearch() use Areavalue which includes plural pixel info(color and distance between pixels) to find point. Please see and advice to me. #region --- GuiBuilder code Start --- ; Script generated by AutoBuilder 0.5 Prototype opt("MouseCoordMode", 1);1=absolute, 0=relative, 2=client opt("PixelCoordMode", 1);1=absolute, 0=relative, 2=client #include <GuiConstants.au3> ;If Not IsDeclared('WS_CLIPSIBLINGS') Then Global $WS_CLIPSIBLINGS = 0x04000000 GUICreate("Demo", 290, 420, (@DesktopWidth - 392) / 2, (@DesktopHeight - 316) / 2) GUICtrlCreateTab(10, 10, 270, 400) GUICtrlCreateTabItem("Create Areavalue") GUICtrlCreateGroup("Info", 20, 40, 250, 80) GUICtrlCreateLabel("MouseX :", 30, 65) GUICtrlCreateLabel("MouseY :", 30, 90) $label_mousex1 = GUICtrlCreateLabel("1024", 105, 65) $label_mousey1 = GUICtrlCreateLabel("1024", 105, 90) $color1 = GUICtrlCreateLabel("", 150, 60, 100, 50) GUICtrlCreateGroup("AreaValue", 20, 130, 250, 145) $edit_areavalue1 = GUICtrlCreateEdit("", 30, 150, 230, 50, $es_autovscroll) $button_clear = GUICtrlCreateButton("Clear", 100, 220, 90, 40) GUICtrlCreateGroup("Usage", 20, 285, 250, 105) GUICtrlCreateLabel("This is demo of searching a rectangle", 30, 305) GUICtrlCreateLabel("of pixels for pixel areavalue provided.", 30, 325) GUICtrlCreateLabel("To make AreaValue, press F5.", 30, 345) GUICtrlCreateLabel("Areavalue can be made by plural point.", 30, 365) GUICtrlCreateTabItem("Find point with Areavalue") GUICtrlCreateGroup("Info", 20, 40, 250, 80) GUICtrlCreateLabel("MouseX :", 30, 65) GUICtrlCreateLabel("MouseY :", 30, 90) $label_mousex2 = GUICtrlCreateLabel("1024", 105, 65) $label_mousey2 = GUICtrlCreateLabel("1024", 105, 90) $color2 = GUICtrlCreateLabel("", 150, 60, 100, 50) GUICtrlCreateGroup("_PixelsSearch() Variable", 20, 130, 250, 205) GUICtrlCreateLabel("* Left", 30, 150) GUICtrlCreateLabel("* Top", 90, 150) GUICtrlCreateLabel("* Right", 150, 150) GUICtrlCreateLabel("* Bottom", 210, 150) $input_left = GUICtrlCreateInput("0", 40, 170, 40, 20) $input_top = GUICtrlCreateInput("0", 100, 170, 40, 20) $input_right = GUICtrlCreateInput(@DesktopWidth - 1, 160, 170, 40, 20) $input_bottom = GUICtrlCreateInput(@DesktopHeight - 1, 220, 170, 40, 20) GUICtrlCreateLabel("* AreaValue", 30, 210) $edit_areavalue2 = GUICtrlCreateEdit("Paste a areavalue here...", 30, 230, 230, 50, $es_autovscroll) GUICtrlCreateLabel("Shade-Variation", 30, 300) GUICtrlCreateLabel("Step", 190, 300) $input_sv = GUICtrlCreateInput("0", 130, 300, 40, 20) $input_step = GUICtrlCreateInput("1", 220, 300, 40, 20) $button_find = GUICtrlCreateButton("Find", 100, 350, 90, 40) GUISetState() HotKeySet("{F5}", "_AreaValue") While 1 _Info() $msg = GUIGetMsg() Select Case $msg = $gui_event_close ExitLoop Case $msg = $button_clear GUICtrlSetData($edit_areavalue1, "") Case $msg = $button_find $left = GUICtrlRead($input_left) $top = GUICtrlRead($input_top) $right = GUICtrlRead($input_right) $bottom = GUICtrlRead($input_bottom) $areavalue = GUICtrlRead($edit_areavalue2) $shadevariation = GUICtrlRead($input_sv) $step = GUICtrlRead($input_step) GUICtrlSetState($button_find, $gui_disable) $pos = _PixelsSearch($left, $top, $right, $bottom, $areavalue, $shadevariation, $step) Select Case Not @Error MouseMove($pos[0], $pos[1]) Case @Error = 1 MsgBox(0, "", "Region is not found.") Case @Error = 2 MsgBox(0, "", "Areavalue is invalid.") EndSelect GUICtrlSetState($button_find, $gui_enable) EndSelect WEnd Exit #endregion --- GuiBuilder generated code End --- Func _Info() $mousepos = MouseGetPos() $mousecolor = PixelGetColor($mousepos[0], $mousepos[1]) GUICtrlSetData($label_mousex1, $mousepos[0]) GUICtrlSetData($label_mousey1, $mousepos[1]) GUICtrlSetBkColor($color1, $mousecolor) GUICtrlSetData($label_mousex2, $mousepos[0]) GUICtrlSetData($label_mousey2, $mousepos[1]) GUICtrlSetBkColor($color2, $mousecolor) EndFunc ;==>_Info Func _AreaValue() $mousepos = MouseGetPos() $mousecolor = PixelGetColor($mousepos[0], $mousepos[1]) $areavalue = Hex($mousepos[0], 3) & Hex($mousepos[1], 3) & Hex($mousecolor, 6) $oldareavalue = GUICtrlRead($edit_areavalue1) GUICtrlSetData($edit_areavalue1, "") GUICtrlSetData($edit_areavalue1, $oldareavalue & $areavalue) EndFunc ;==>_AreaValue Func _PixelsSearch($left, $top, $right, $bottom, $areavalue, $shadevariation = 0, $step = 1) ;=============================================================================== ; ; Description: Searches a rectangle of pixels for the pixel areavalue provided. ; Areavalue is combination of one or more pixel point. ; Syntax: _PixelsSearch ( left, top, right, bottom, color [, shade-variation] [, step]] ) ; Parameter(s): left - left coordinate of rectangle. ; top - top coordinate of rectangle. ; right - right coordinate of rectangle. ; bottom - coordinate of rectangle. ; checksum - checksum value of the region. ; shadevariation - 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). ; step - 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 Value(s): On Success - Returns a two-element array of pixel's coordinates. (Array[0] = x, Array[1] = y) ; On Failure - Sets @error to 1 if region is not found. ; - Sets @error to 2 if areavalue is invalid ; Author(s): quixote79 ; Note(s): Similar to PixelSearch() ; It works only under Opt("MouseCoordMode", 1) and Opt("PixelCoordMode", 1) ; ;=============================================================================== $areavaluelength = StringLen($areavalue) / 12 If IsInt($areavaluelength) = 1 Then Local $x[$areavaluelength] Local $y[$areavaluelength] Local $color[$areavaluelength] If $areavaluelength <> 1 Then Local $xg[$areavaluelength - 1] Local $yg[$areavaluelength - 1] EndIf For $a = 0 To $areavaluelength - 1 $x[$a] = Dec(StringMid($areavalue, 12 * $a + 1, 3)) $y[$a] = Dec(StringMid($areavalue, 12 * $a + 4, 3)) $color[$a] = Dec(StringMid($areavalue, 12 * $a + 7, 6)) Next For $b = $areavaluelength - 2 To 0 Step - 1 $xg[$b] = $x[$b + 1] - $x[0] $yg[$b] = $y[$b + 1] - $y[0] Next For $c = $top To $bottom $mleft = $left Do $fpos = PixelSearch($mleft, $c, $right, $c, $color[0], $shadevariation, $step) If Not @error Then $state = 0 For $d = 0 To $areavaluelength - 2 If PixelGetColor($fpos[0] + $xg[$d], $fpos[1] + $yg[$d]) <> $color[$d + 1] Then $state = 1 ExitLoop EndIf Next If $state = 0 Then Return $fpos ExitLoop Else $mleft = $fpos[0] + $step EndIf Else ExitLoop EndIf Until $mleft >= $right Next SetError(1) Else SetError(2) EndIf EndFunc ;==>_PixelsSearch
-
Soundplay can play typically a WAV or MP3 not Midi. Can you give me a hint about midi function like this. playmidi($note(s), $duration, $instrument)
-
Can I play specified notes and specified instruments without using a midi file?
-
I want to play sound using midi interface. Is there any method of playing, reading, saving midi(file)?
-
Then there is no way to get 3468543678?
-
Msgbox(0, "", DEC("CEBDC6BE")) I think the result may be 3468543678 but AutoIt said -826423618. What's wrong??