Farbcode & Koordinaten

  • Hallo ich hoffe jmd von euch kann mir helfen
    Ich habe in den AutoIt Beispielen ein Script gefunden, welches die Koordinaten der Maus anzeigt. Ich wollte dieses umschreiben, dass es auch die aktuelle Farbe des Pixels anzeigt ebenfalls anzeigt, und diese Werte in eine .Ini-Datei speichert, dass ich diese mit einem andere Script aufrufen kann (das andere script funktioniert).
    Leider funktioniert dies nicht wirklich. Ich hoffe jmd von euch kann mir helfen.
    Danke schon mal im vorraus

    Spoiler anzeigen

    #include <GUIConstantsEx.au3>

    Opt('MustDeclareVars', 1)

    Global $x, $y, $var, $var, $b

    HotKeySet("{DEL}","Write")

    Example()

    Func Example()
    Local $msg

    HotKeySet("{Esc}", "GetPos")

    GUICreate("Press Esc to Get Pos", 400, 400)
    $x = GUICtrlCreateLabel("0", 10, 10, 50)
    $y = GUICtrlCreateLabel("0", 10, 30, 50)
    $var = GUICtrlCreateLabel("0", 10, 50, 50)
    GUISetState()

    Do
    $msg = GUIGetMsg()
    Until $msg = $GUI_EVENT_CLOSE
    EndFunc

    Func GetPos()
    Local $a, $b

    $a = GUIGetCursorInfo()
    GUICtrlSetData($x, $a[0])
    GUICtrlSetData($y, $a[1])

    $b = PixelGetColor( $x, $y)
    GUICtrlSetData( $var , $b)
    EndFunc

    func Write()
    IniWrite("Konfig.ini", "Koordinaten","x",$x)
    IniWrite("Konfig.ini", "Koordinaten","y",$y)
    EndFunc

  • So?

    Spoiler anzeigen
    [autoit]

    #include <GUIConstantsEx.au3>

    [/autoit] [autoit][/autoit] [autoit]

    HotKeySet ( "{DEL}", "_aufzeichnen" )

    [/autoit] [autoit][/autoit] [autoit]

    While 1
    WEnd

    [/autoit] [autoit][/autoit] [autoit]

    Func _aufzeichnen()

    [/autoit] [autoit][/autoit] [autoit]

    $a=MouseGetPos()
    $b=PixelGetColor( $a[0], $a[1])

    [/autoit] [autoit][/autoit] [autoit]

    FileWrite( "Koords.txt", "X Posi Maus "&$a[0]&@CRLF)
    FileWrite( "Koords.txt", "Y Posi Maus "&$a[1]&@CRLF)
    FileWrite( "Koords.txt", "Farbe: "&$b&@CRLF)

    [/autoit] [autoit][/autoit] [autoit]

    EndFunc

    [/autoit]

    Deins war aber relativ zur GUI, weis jetzt nicht wie du es wolltest.

  • Spoiler anzeigen
    [autoit]

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

    [/autoit] [autoit][/autoit] [autoit]

    #Region ### START Koda GUI section ### Form=
    $Form1 = GUICreate("Pixelfarbenfinder", 215, 102, 193, 115)
    $Label1 = GUICtrlCreateLabel("", 6, 8, 209, 17)
    $Label2 = GUICtrlCreateLabel("", 6, 25, 204, 40)
    $Label3 = GUICtrlCreateLabel("", 6, 73, 209, 17)
    GUISetState(@SW_SHOW)
    #EndRegion ### END Koda GUI section ###
    $PosOld = MouseGetPos ()
    AdlibEnable ("_Pos",10)
    While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
    Case $GUI_EVENT_CLOSE
    Exit

    [/autoit] [autoit][/autoit] [autoit]

    EndSwitch
    WEnd
    Func _Pos()
    $Pos = MouseGetPos()
    If $PosOld[0] <> $Pos[0] OR $PosOld[1] <> $Pos[1] Then
    $PosOld = $Pos
    $Color = PixelGetColor ($Pos[0],$Pos[1])
    $Color = "0x" & Hex ($Color,6)
    GUICtrlSetData ($Label1,"X:" & $Pos[0] & " Y:" & $Pos[1])
    GUICtrlSetBkColor ($Label2,$Color)
    GUICtrlSetData ($Label3,"Farbcode:" & $Color)
    EndIf
    EndFunc

    [/autoit]

    mfg. Jam00