Finder ile Coordinat Ve Color

Programlama dilleri konusunda bilgi paylaşım alanıdır.
Cevapla
darendeli
Byte4
Byte4
Mesajlar: 184
Kayıt: 06 Haz 2016, 16:55

Finder ile Coordinat Ve Color

Mesaj gönderen darendeli »

Finder coordinat ve hex rengini aldırmak istiyorum ama 2 side ayrı finder ile olabilir aynı resimdeki gibi
Resim

Kod: Tümünü seç

Opt('GUIOnEventMode', '1')
HotKeySet('!p', '_Pause')

Global $Pause = False

$GUI = GUICreate('Pixel Finder Tool v1.0', '150', '40', '-1', '-1', '-1', '128')
GUISetOnEvent(-3, '_Exit')
GUISetFont ('9', '600', '', 'Arial')
$Input = GUICtrlCreateInput('', '0', '0', '150', '20', '1')
$Input2 = GUICtrlCreateInput('', '0', '20', '150', '20', '1')
GUICtrlSetState($Input, 128)
GUICtrlSetState($Input2, 128)
GUISetState(@SW_SHOW, $GUI)
WinSetOnTop($GUI, '', '1')

While 1
If Not $Pause Then
$Pos = MouseGetPos()
$Pixel = PixelGetColor($Pos['0'], $Pos['1'])
$Pixel = '0x' & Hex($Pixel, '6')
GUICtrlSetData($Input, $Pixel)
GUICtrlSetData($Input2, "X: " & $Pos['0'] & "  Y: " & $Pos['1'])
EndIf
Sleep(15)
WEnd

Func _Pause()
If Not $Pause Then ClipPut(GUICtrlRead ($Input) & @CRLF & GUICtrlRead ($Input2))
$Pause = Not $Pause
EndFunc   ;==>_Pause

Func _Exit()
Exit
EndFunc   ;==>_Exit
Program Yazmanın En Güzel Yanı Birilerinin Bu Programlardan Faydalandığını Görmektir..
Kullanıcı avatarı
BlueLife
Kilobyte1
Kilobyte1
Mesajlar: 215
Kayıt: 29 Ağu 2014, 20:42

Re: Finder ile Coordinat Ve Color

Mesaj gönderen BlueLife »

@darendeli

Ne istediğini tam olarak anlamadım malesef. Bu arada kodlarında arrayları $Pos['1'] şeklinde kullanmışsın. Bu şekilde kullanım sorun çıkartabilir. Rakamları tırnak işareti ile kullanma array için. Tırmak işareti ile kullanılan değer ile normal rakam ile kullanılan değer farklıdır. Yani normalde "1" ile 1 farklı değişken biçimidir. $Pos['1'] yerine $Pos[1] şeklinde kullanmalısın.
darendeli
Byte4
Byte4
Mesajlar: 184
Kayıt: 06 Haz 2016, 16:55

Re: Finder ile Coordinat Ve Color

Mesaj gönderen darendeli »

Yapmak istedigim Finderi Sürükleyip Coordinat ve Hex Rengini Almak inputa Yazıdrmak
Bu inputtaki Corrdinat Ve Renge Mouse ile Tıklama Yaptırmak istiyorumda Yapamadim Nasıl Kullana Bilirim İnputtaki Degerleri
Videodaki Mantıgı Anlamaya Calısıyorum...Deneme Yaptım Olmadı..
https://www.youtube.com/watch?v=dJbJcNqXFks

Kod: Tümünü seç

While 1
$SurekliAtakpixel = PixelSearch (198,358,1000,623,0x331111);;Bu koordinat Ve REnk Yerine İNputlardan Almak istiyorum
	If IsArray ($SurekliAtakpixel) = True Then
		MouseMove ($SurekliAtakpixel [0],$SurekliAtakpixel [1],1)
MouseClick	("left",$SurekliAtakpixel [0],$SurekliAtakpixel [1],1)
	EndIf
Program Yazmanın En Güzel Yanı Birilerinin Bu Programlardan Faydalandığını Görmektir..
Kullanıcı avatarı
BlueLife
Kilobyte1
Kilobyte1
Mesajlar: 215
Kayıt: 29 Ağu 2014, 20:42

Re: Finder ile Coordinat Ve Color

Mesaj gönderen BlueLife »

@darendeli

Ilgili istediğin buton özelliğini için yeterli vakit ayıramadığımdan yardımcı olamam. Belki autoit forumlarında benzeri bir örnek bulabilirsin.
Önceki verdiğin örnekte hotkey var ve bunu kullanabilirsin. Ek yaptım kurcalarsın.
Yeterli vakit ayıramayacağım için fazla yardımcı olamıyorum kusura bakma. Kolay gelsin...

Kod: Tümünü seç

HotKeySet('!p', '_Pause')

Global $Pause = False

$GUI = GUICreate('Pixel Finder Tool v1.0', 150, 120, -1, -1, -1, 128)
GUISetFont(9, 600, '', 'Arial')
$Input = GUICtrlCreateInput('', 0, 0, 150, 20, 1)
$Input2 = GUICtrlCreateInput('', 0, 20, 150, 20, 1)

GUICtrlCreateLabel('Durdurmak için Alt + P ye bas', 0, 45, 150, 35, 1)
Local $button1 = GUICtrlCreateButton('Konumu bul', 0, 80, 150, 20)
Local $button2 = GUICtrlCreateButton('Renk Konumuna Tıklat', 0, 100, 150, 20)

GUICtrlSetState($Input, 128)
GUICtrlSetState($Input2, 128)
GUISetState(@SW_SHOW, $GUI)
WinSetOnTop($GUI, '', 1)

Local $ClickMouse = False
Local $SurekliAtakpixel, $BulunanDegerlar[3]
While 1
	Switch GUIGetMsg()
		Case -3
			Exit
		Case $button1
			$Pause = Not $Pause

		Case $button2
			$Pause = Not $Pause
			$ClickMouse = True

	EndSwitch
	If $ClickMouse = True Then
		$SurekliAtakpixel = PixelSearch($BulunanDegerlar[1], $BulunanDegerlar[2], 100, 100, $BulunanDegerlar[0]);;Bu koordinat Ve REnk Yerine İNputlardan Almak istiyorum
		If IsArray($SurekliAtakpixel) = True Then
			MouseMove($SurekliAtakpixel[0], $SurekliAtakpixel[1], 1)
			MouseClick("left", $SurekliAtakpixel[0], $SurekliAtakpixel[1], 1)
		EndIf
		Exit
	ElseIf Not $Pause Then
		$Pos = MouseGetPos()
		$Pixel = PixelGetColor($Pos[0], $Pos[1])
		$Pixel = '0x' & Hex($Pixel, 6)
		GUICtrlSetData($Input, $Pixel)
		GUICtrlSetData($Input2, "X: " & $Pos[0] & "  Y: " & $Pos[1])
		$BulunanDegerlar[0] = $Pixel
		$BulunanDegerlar[1] = $Pos[0]
		$BulunanDegerlar[2] = $Pos[1]

	EndIf
	Sleep(15)
WEnd

Func _Pause()
	If Not $Pause Then ClipPut(GUICtrlRead($Input) & @CRLF & GUICtrlRead($Input2))
	$Pause = Not $Pause
EndFunc   ;==>_Pause
darendeli
Byte4
Byte4
Mesajlar: 184
Kayıt: 06 Haz 2016, 16:55

Re: Finder ile Coordinat Ve Color

Mesaj gönderen darendeli »

Ben Bir seyler Buldum Biraz Ugrastim ama Devamında Yardımcı olurmusunuz.. Aynı Bu sekilde Olucak
Yalnız Bu pencere Baslıgı Handle fln alıyor bunların Yerine Sadece Hex Rengi Ve Coordinat Ayarlayabilirmiyiz..
3 Tane Ayrı Arac ile 2 si ile Coordinat 1i ile Hex rengini Aldırmak Gerekli Yapmak istedigim Sey icin...

Kod: Tümünü seç

#include <GUIConstants.au3>

Global $CURSOR_TARGET = WriteResource( _
"0x000002000100202000000F001000300100001600000028000000200000004000000001000100000000008000" & _
"00000000000000000000020000000200000000000000FFFFFF0000000000000000000000000000000000000000" & _
"000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000" & _
"000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000" & _
"00000000000000000000000000000000000000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF" & _
"FFFFFFF83FFFFFE6CFFFFFD837FFFFBEFBFFFF783DFFFF7EFDFFFEAC6AFFFEABAAFFFE0280FFFEABAAFFFEAC6A" & _
"FFFF7EFDFFFF783DFFFFBEFBFFFFD837FFFFE6CFFFFFF83FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF" & _
"FFFFFFFFFFFFFFFFFFFFFFFF")
Global $ICON_TARGET_FULL = WriteResource( _
"0x0000010001002020080000000000E80200001600000028000000200000004000000001000400000000000002" & _
"000000000000000000001000000010000000000000000000800000800000008080008000000080008000808000" & _
"00C0C0C000808080000000FF0000FF000000FFFF00FF000000FF00FF00FFFF0000FFFFFF000000000000000000" & _
"00000000000000000000000000000000000000000000000000FFFFFFFFFFFFFFFFFFFFFFFFFFFFF000FFFFFFFF" & _
"FFFFFFFFFFFFFFFFFFFFF000FFFFFFFFFFFF00000FFFFFFFFFFFF000FFFFFFFFFF00FF0FF00FFFFFFFFFF000FF" & _
"FFFFFFF0FF00000FF0FFFFFFFFF000FFFFFFFF0FFFFF0FFFFF0FFFFFFFF000FFFFFFF0FFFF00000FFFF0FFFFFF" & _
"F000FFFFFFF0FFFFFF0FFFFFF0FFFFFFF000FFFFFF0F0F0FF000FF0F0F0FFFFFF000FFFFFF0F0F0F0FFF0F0F0F" & _
"0FFFFFF000FFFFFF0000000F0F0000000FFFFFF000FFFFFF0F0F0F0FFF0F0F0F0FFFFFF000FFFFFF0F0F0FF000" & _
"FF0F0F0FFFFFF000FFFFFFF0FFFFFF0FFFFFF0FFFFFFF000FFFFFFF0FFFF00000FFFF0FFFFFFF000FFFFFFFF0F" & _
"FFFF0FFFFF0FFFFFFFF000FFFFFFFFF0FF00000FF0FFFFFFFFF000FFFFFFFFFF00FF0FF00FFFFFFFFFF000FFFF" & _
"FFFFFFFF00000FFFFFFFFFFFF000FFFFFFFFFFFFFFFFFFFFFFFFFFFFF000FFFFFFFFFFFFFFFFFFFFFFFFFFFFF0" & _
"00FFFFFFFFFFFFFFFFFFFFFFFFFFFFF000000000000000000000000000000000007770CCCCCCCCCCCCCCCCCCCC" & _
"C07770007070CCCCCCCCCCCCCCCCCCCCC07070007770CCCCCCCCCCCCCCCCCCCCC0777000000000000000000000" & _
"000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000" & _
"000000000000000000FFFFFFFF8000000080000000800000008000000080000000800000008000000080000000" & _
"800000008000000080000000800000008000000080000000800000008000000080000000800000008000000080" & _
"0000008000000080000000800000008000000080000000800000008000000080000000FFFFFFFFFFFFFFFFFFFF" & _
"FFFF")
Global $ICON_TARGET_EMPTY = WriteResource( _
"0x0000010001002020080000000000E80200001600000028000000200000004000000001000400000000000002" & _
"000000000000000000001000000010000000000000000000800000800000008080008000000080008000808000" & _
"00C0C0C000808080000000FF0000FF000000FFFF00FF000000FF00FF00FFFF0000FFFFFF000000000000000000" & _
"00000000000000000000000000000000000000000000000000FFFFFFFFFFFFFFFFFFFFFFFFFFFFF000FFFFFFFF" & _
"FFFFFFFFFFFFFFFFFFFFF000FFFFFFFFFFFFFFFFFFFFFFFFFFFFF000FFFFFFFFFFFFFFFFFFFFFFFFFFFFF000FF" & _
"FFFFFFFFFFFFFFFFFFFFFFFFFFF000FFFFFFFFFFFFFFFFFFFFFFFFFFFFF000FFFFFFFFFFFFFFFFFFFFFFFFFFFF" & _
"F000FFFFFFFFFFFFFFFFFFFFFFFFFFFFF000FFFFFFFFFFFFFFFFFFFFFFFFFFFFF000FFFFFFFFFFFFFFFFFFFFFF" & _
"FFFFFFF000FFFFFFFFFFFFFFFFFFFFFFFFFFFFF000FFFFFFFFFFFFFFFFFFFFFFFFFFFFF000FFFFFFFFFFFFFFFF" & _
"FFFFFFFFFFFFF000FFFFFFFFFFFFFFFFFFFFFFFFFFFFF000FFFFFFFFFFFFFFFFFFFFFFFFFFFFF000FFFFFFFFFF" & _
"FFFFFFFFFFFFFFFFFFF000FFFFFFFFFFFFFFFFFFFFFFFFFFFFF000FFFFFFFFFFFFFFFFFFFFFFFFFFFFF000FFFF" & _
"FFFFFFFFFFFFFFFFFFFFFFFFF000FFFFFFFFFFFFFFFFFFFFFFFFFFFFF000FFFFFFFFFFFFFFFFFFFFFFFFFFFFF0" & _
"00FFFFFFFFFFFFFFFFFFFFFFFFFFFFF000000000000000000000000000000000007770CCCCCCCCCCCCCCCCCCCC" & _
"C07770007070CCCCCCCCCCCCCCCCCCCCC07070007770CCCCCCCCCCCCCCCCCCCCC0777000000000000000000000" & _
"000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000" & _
"000000000000000000FFFFFFFF8000000080000000800000008000000080000000800000008000000080000000" & _
"800000008000000080000000800000008000000080000000800000008000000080000000800000008000000080" & _
"0000008000000080000000800000008000000080000000800000008000000080000000FFFFFFFFFFFFFFFFFFFF" & _
"FFFF")

; Loading cursor from file
$hTargetCursor = DllCall("User32.dll", "int", "LoadCursorFromFile", "str", $CURSOR_TARGET)
$hTargetCursor = $hTargetCursor[0]

Global $g_StartSearch = False, $gFoundWindow = 0, $gOldCursor
;Global $WM_MOUSEMOVE = 0x200
;Global $WM_LBUTTONUP = 0x202

#Region ### START Koda GUI section ### Form=
$hGUI = GUICreate("Window Finder", 336, 304, -1, -1)
GUICtrlCreateGroup("Darendeli  Aktif Bot", 80, 0, 497, 65)
GUICtrlCreateLabel("Sol Koordinat:", 31, 18, 127, 17, $SS_RIGHT)
GUICtrlCreateLabel("Handle:", 87, 42, 41, 17, $SS_RIGHT)
$hLabelTitle = GUICtrlCreateLabel("", 233, 18, 436, 17, BitOR($SS_CENTER,$SS_RIGHT,$SS_GRAYFRAME,$SS_WHITEFRAME,$SS_SIMPLE))
$hLabelWnd = GUICtrlCreateLabel("", 133, 42, 100, 17)
GUICtrlCreateLabel("Class:", 240, 42, 32, 17)
$hLabelClass = GUICtrlCreateLabel("", 272, 42, 300, 17, BitOR($SS_CENTER,$SS_RIGHT,$SS_GRAYFRAME,$SS_WHITEFRAME,$SS_SIMPLE))
GUICtrlCreateGroup("", -99, -99, 1, 1)
GUICtrlCreateGroup("", 8, 0, 65, 65)
$hTargetPic = GUICtrlCreateIcon($ICON_TARGET_FULL, 0, 24, 20, 32, 32, BitOR($SS_NOTIFY,$WS_GROUP))
GUICtrlCreateGroup("", -99, -99, 1, 1)




$hOK = GUICtrlCreateButton("Close", 504, 72, 75, 25, 0)
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###

GUIRegisterMsg ($WM_MOUSEMOVE, "WM_MOUSEMOVE_FUNC")
GUIRegisterMsg ($WM_LBUTTONUP, "WM_LBUTTONUP_FUNC")

While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE, $hOK
            Exit
        Case $hTargetPic
            $g_StartSearch = True
            DllCall("user32.dll", "hwnd", "SetCapture", "hwnd", $hGUI)
            $gOldCursor = DllCall("user32.dll", "int", "SetCursor", "int", $hTargetCursor)
            If not @error Then $gOldCursor = $gOldCursor[0]
            GUICtrlSetImage($hTargetPic, $ICON_TARGET_EMPTY)
    EndSwitch
Wend

Func WM_MOUSEMOVE_FUNC($hWnd, $nMsg, $wParam, $lParam)
	While 1
    If not $g_StartSearch Then Return 1
    Local $mPos = MouseGetPos()
    $hWndUnder = DllCall("user32.dll", "hwnd", "WindowFromPoint", "long", $mPos[0], "long", $mPos[1])
    If not @error Then $hWndUnder = $hWndUnder[0]
    If CheckFoundWindow($hWndUnder) Then
        GUICtrlSetData($hLabelTitle,$mPos[0]& ","& $mPos[1])
        GUICtrlSetData($hLabelWnd, $hWndUnder)
        GUICtrlSetData($hLabelClass, GetWindowClass($hWndUnder))
        $gFoundWindow = $hWndUnder
    EndIf
    Return 1
	WEnd
EndFunc

Func WM_LBUTTONUP_FUNC($hWnd, $nMsg, $wParam, $lParam)
    If not $g_StartSearch Then Return 1
    $g_StartSearch = False
    ; Release captured cursor
    DllCall("user32.dll", "int", "ReleaseCapture")
    DllCall("user32.dll", "int", "SetCursor", "int", $gOldCursor)
    GUICtrlSetImage($hTargetPic, $ICON_TARGET_FULL)
    Return 1
EndFunc

Func CheckFoundWindow($hFoundWnd)
  If $hFoundWnd = $hGUI Then Return False
  If $hFoundWnd = 0 Then Return False
  If $hFoundWnd = $gFoundWindow Then Return False
  If not WinExists($hFoundWnd) Then Return False
  Local $hTemp = DllCall("user32.dll", "hwnd", "GetParent", "hwnd", $hFoundWnd)
  If not @error and $hTemp[0] = $hGUI Then Return False
  Return True
EndFunc

Func GetWindowClass($hWnd)
    $pClassName = DllStructCreate("char[256]")
    DllCall("user32.dll", "int", "GetClassName", "hwnd", $hWnd, "ptr", DllStructGetPtr($pClassName), "int", 255)
    Return DllStructGetData($pClassName, 1)
EndFunc

Func WriteResource($sbStringRes)
    Local $sTempFile
    Do
        $sTempFile = @TempDir & "\temp" & Hex(Random(0, 65535), 4)
    Until not FileExists($sTempFile)
    Local $hFile = FileOpen($sTempFile, 2+16)
    FileWrite($hFile, $sbStringRes)
    FileClose($hFile)
    Return $sTempFile
EndFunc

Func OnAutoitExit()
    If IsDeclared("CURSOR_TARGET") Then
        FileDelete($ICON_TARGET_FULL)
        FileDelete($ICON_TARGET_EMPTY)
        FileDelete($CURSOR_TARGET)
    EndIf
EndFunc
Program Yazmanın En Güzel Yanı Birilerinin Bu Programlardan Faydalandığını Görmektir..
Kullanıcı avatarı
BlueLife
Kilobyte1
Kilobyte1
Mesajlar: 215
Kayıt: 29 Ağu 2014, 20:42

Re: Finder ile Coordinat Ve Color

Mesaj gönderen BlueLife »

@darendeli

Üç farklı input için ayrı işlem yapmak istiyorsan, verdiğin örnek üzerine ufak değişiklikler yaptım. Yanlış anladıysam kusura bakma...
Kolay gelsin...

Kod: Tümünü seç

#include <GUIConstants.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>

Global $CURSOR_TARGET = WriteResource( _
		"0x000002000100202000000F001000300100001600000028000000200000004000000001000100000000008000" & _
		"00000000000000000000020000000200000000000000FFFFFF0000000000000000000000000000000000000000" & _
		"000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000" & _
		"000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000" & _
		"00000000000000000000000000000000000000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF" & _
		"FFFFFFF83FFFFFE6CFFFFFD837FFFFBEFBFFFF783DFFFF7EFDFFFEAC6AFFFEABAAFFFE0280FFFEABAAFFFEAC6A" & _
		"FFFF7EFDFFFF783DFFFFBEFBFFFFD837FFFFE6CFFFFFF83FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF" & _
		"FFFFFFFFFFFFFFFFFFFFFFFF")
Global $ICON_TARGET_FULL = WriteResource( _
		"0x0000010001002020080000000000E80200001600000028000000200000004000000001000400000000000002" & _
		"000000000000000000001000000010000000000000000000800000800000008080008000000080008000808000" & _
		"00C0C0C000808080000000FF0000FF000000FFFF00FF000000FF00FF00FFFF0000FFFFFF000000000000000000" & _
		"00000000000000000000000000000000000000000000000000FFFFFFFFFFFFFFFFFFFFFFFFFFFFF000FFFFFFFF" & _
		"FFFFFFFFFFFFFFFFFFFFF000FFFFFFFFFFFF00000FFFFFFFFFFFF000FFFFFFFFFF00FF0FF00FFFFFFFFFF000FF" & _
		"FFFFFFF0FF00000FF0FFFFFFFFF000FFFFFFFF0FFFFF0FFFFF0FFFFFFFF000FFFFFFF0FFFF00000FFFF0FFFFFF" & _
		"F000FFFFFFF0FFFFFF0FFFFFF0FFFFFFF000FFFFFF0F0F0FF000FF0F0F0FFFFFF000FFFFFF0F0F0F0FFF0F0F0F" & _
		"0FFFFFF000FFFFFF0000000F0F0000000FFFFFF000FFFFFF0F0F0F0FFF0F0F0F0FFFFFF000FFFFFF0F0F0FF000" & _
		"FF0F0F0FFFFFF000FFFFFFF0FFFFFF0FFFFFF0FFFFFFF000FFFFFFF0FFFF00000FFFF0FFFFFFF000FFFFFFFF0F" & _
		"FFFF0FFFFF0FFFFFFFF000FFFFFFFFF0FF00000FF0FFFFFFFFF000FFFFFFFFFF00FF0FF00FFFFFFFFFF000FFFF" & _
		"FFFFFFFF00000FFFFFFFFFFFF000FFFFFFFFFFFFFFFFFFFFFFFFFFFFF000FFFFFFFFFFFFFFFFFFFFFFFFFFFFF0" & _
		"00FFFFFFFFFFFFFFFFFFFFFFFFFFFFF000000000000000000000000000000000007770CCCCCCCCCCCCCCCCCCCC" & _
		"C07770007070CCCCCCCCCCCCCCCCCCCCC07070007770CCCCCCCCCCCCCCCCCCCCC0777000000000000000000000" & _
		"000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000" & _
		"000000000000000000FFFFFFFF8000000080000000800000008000000080000000800000008000000080000000" & _
		"800000008000000080000000800000008000000080000000800000008000000080000000800000008000000080" & _
		"0000008000000080000000800000008000000080000000800000008000000080000000FFFFFFFFFFFFFFFFFFFF" & _
		"FFFF")
Global $ICON_TARGET_EMPTY = WriteResource( _
		"0x0000010001002020080000000000E80200001600000028000000200000004000000001000400000000000002" & _
		"000000000000000000001000000010000000000000000000800000800000008080008000000080008000808000" & _
		"00C0C0C000808080000000FF0000FF000000FFFF00FF000000FF00FF00FFFF0000FFFFFF000000000000000000" & _
		"00000000000000000000000000000000000000000000000000FFFFFFFFFFFFFFFFFFFFFFFFFFFFF000FFFFFFFF" & _
		"FFFFFFFFFFFFFFFFFFFFF000FFFFFFFFFFFFFFFFFFFFFFFFFFFFF000FFFFFFFFFFFFFFFFFFFFFFFFFFFFF000FF" & _
		"FFFFFFFFFFFFFFFFFFFFFFFFFFF000FFFFFFFFFFFFFFFFFFFFFFFFFFFFF000FFFFFFFFFFFFFFFFFFFFFFFFFFFF" & _
		"F000FFFFFFFFFFFFFFFFFFFFFFFFFFFFF000FFFFFFFFFFFFFFFFFFFFFFFFFFFFF000FFFFFFFFFFFFFFFFFFFFFF" & _
		"FFFFFFF000FFFFFFFFFFFFFFFFFFFFFFFFFFFFF000FFFFFFFFFFFFFFFFFFFFFFFFFFFFF000FFFFFFFFFFFFFFFF" & _
		"FFFFFFFFFFFFF000FFFFFFFFFFFFFFFFFFFFFFFFFFFFF000FFFFFFFFFFFFFFFFFFFFFFFFFFFFF000FFFFFFFFFF" & _
		"FFFFFFFFFFFFFFFFFFF000FFFFFFFFFFFFFFFFFFFFFFFFFFFFF000FFFFFFFFFFFFFFFFFFFFFFFFFFFFF000FFFF" & _
		"FFFFFFFFFFFFFFFFFFFFFFFFF000FFFFFFFFFFFFFFFFFFFFFFFFFFFFF000FFFFFFFFFFFFFFFFFFFFFFFFFFFFF0" & _
		"00FFFFFFFFFFFFFFFFFFFFFFFFFFFFF000000000000000000000000000000000007770CCCCCCCCCCCCCCCCCCCC" & _
		"C07770007070CCCCCCCCCCCCCCCCCCCCC07070007770CCCCCCCCCCCCCCCCCCCCC0777000000000000000000000" & _
		"000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000" & _
		"000000000000000000FFFFFFFF8000000080000000800000008000000080000000800000008000000080000000" & _
		"800000008000000080000000800000008000000080000000800000008000000080000000800000008000000080" & _
		"0000008000000080000000800000008000000080000000800000008000000080000000FFFFFFFFFFFFFFFFFFFF" & _
		"FFFF")

; Loading cursor from file
$hTargetCursor = DllCall("User32.dll", "int", "LoadCursorFromFile", "str", $CURSOR_TARGET)
$hTargetCursor = $hTargetCursor[0]

Global $g_StartSearch = False, $gFoundWindow = 0, $gOldCursor
;Global $WM_MOUSEMOVE = 0x200
;Global $WM_LBUTTONUP = 0x202

#region ### START Koda GUI section ### Form=
Global $hGUI = GUICreate("Window Finder", 300, 304, -1, -1)

GUICtrlCreateGroup("Grup1", 5, 5, 290, 60)
GUICtrlCreateLabel("Top Left:", 15, 30, 100, 18)
Global $INPUT1 = GUICtrlCreateInput("", 120, 30, 100, 18, 0x0800)
Global $hTargetPic1 = GUICtrlCreateIcon($ICON_TARGET_FULL, 0, 250, 20, 32, 32, BitOR($SS_NOTIFY, $WS_GROUP))

GUICtrlCreateGroup("Grup2", 5, 75, 290, 60)
GUICtrlCreateLabel("Bottom Right:", 15, 100, 100, 18)
Global $INPUT2 = GUICtrlCreateInput("", 120, 100, 100, 18, 0x0800)
Global $hTargetPic2 = GUICtrlCreateIcon($ICON_TARGET_FULL, 0, 250, 90, 32, 32, BitOR($SS_NOTIFY, $WS_GROUP))


GUICtrlCreateGroup("Grup3", 5, 145, 290, 60)
GUICtrlCreateLabel("Color:", 15, 170, 100, 18)
Global $INPUT3 = GUICtrlCreateInput("", 120, 170, 100, 18, 0x0800)
Global $hTargetPic3 = GUICtrlCreateIcon($ICON_TARGET_FULL, 0, 250, 160, 32, 32, BitOR($SS_NOTIFY, $WS_GROUP))

$hOK = GUICtrlCreateButton("Close", 504, 72, 75, 25, 0)
GUISetState(@SW_SHOW)
#endregion ### END Koda GUI section ###

GUIRegisterMsg($WM_MOUSEMOVE, "WM_MOUSEMOVE_FUNC")
GUIRegisterMsg($WM_LBUTTONUP, "WM_LBUTTONUP_FUNC")

While 1
	$nMsg = GUIGetMsg()
	Switch $nMsg
		Case $GUI_EVENT_CLOSE, $hOK
			Exit

		Case $hTargetPic1, $hTargetPic2, $hTargetPic3
			$g_StartSearch = $nMsg

			DllCall("user32.dll", "hwnd", "SetCapture", "hwnd", $hGUI)
			$gOldCursor = DllCall("user32.dll", "int", "SetCursor", "int", $hTargetCursor)
			If Not @error Then $gOldCursor = $gOldCursor[0]
			GUICtrlSetImage($g_StartSearch, $ICON_TARGET_EMPTY)
	EndSwitch
WEnd

Func WM_MOUSEMOVE_FUNC($hWnd, $nMsg, $wParam, $lParam)
	If Not $g_StartSearch Then Return 1
	Local $mPos = MouseGetPos()
	Switch $g_StartSearch
		Case $hTargetPic1
			GUICtrlSetData($INPUT1, $mPos[0] & "," & $mPos[1])
		Case $hTargetPic2
			GUICtrlSetData($INPUT2, $mPos[0] & "," & $mPos[1])
		Case $hTargetPic3
			GUICtrlSetData($INPUT3, '0x' & Hex(PixelGetColor($mPos[0], $mPos[1]), 6))
	EndSwitch
	Return 1
EndFunc   ;==>WM_MOUSEMOVE_FUNC

Func WM_LBUTTONUP_FUNC($hWnd, $nMsg, $wParam, $lParam)
	If $g_StartSearch = 0 Then Return 1
	; Release captured cursor
	DllCall("user32.dll", "int", "ReleaseCapture")
	DllCall("user32.dll", "int", "SetCursor", "int", $gOldCursor)
	GUICtrlSetImage($g_StartSearch, $ICON_TARGET_FULL)

	$g_StartSearch = 0
	Return 1
EndFunc   ;==>WM_LBUTTONUP_FUNC

Func WriteResource($sbStringRes)
	Local $sTempFile
	Do
		$sTempFile = @TempDir & "\temp" & Hex(Random(0, 65535), 4)
	Until Not FileExists($sTempFile)
	Local $hFile = FileOpen($sTempFile, 2 + 16)
	FileWrite($hFile, $sbStringRes)
	FileClose($hFile)
	Return $sTempFile
EndFunc   ;==>WriteResource

Func OnAutoitExit()
	If IsDeclared("CURSOR_TARGET") Then
		FileDelete($ICON_TARGET_FULL)
		FileDelete($ICON_TARGET_EMPTY)
		FileDelete($CURSOR_TARGET)
	EndIf
EndFunc   ;==>OnAutoitExit
darendeli
Byte4
Byte4
Mesajlar: 184
Kayıt: 06 Haz 2016, 16:55

Re: Finder ile Coordinat Ve Color

Mesaj gönderen darendeli »

Tesekkürler..Coordinat Ve Renge Göre İşlem Yaptıra Bilirsem..İşlem Bitecek..
Program Yazmanın En Güzel Yanı Birilerinin Bu Programlardan Faydalandığını Görmektir..
Cevapla