Koordinaten einfügen in AutoIt

  • Hallo,
    ich würde gerne mit einem Bfehl in einer GUI immer angezeigt bekommen in X , Y wo sich die Maus grade befindet, wie sezt ich sowas in ein Befehl um?
    Dachte sowas wie
    While
    $Y = Mouse...
    $X = Mouse..
    Wend

    mfg

  • geht z. B. so

    [autoit]

    While 1
    $pos = MouseGetPos()
    ToolTip($pos[0] & ", " & $pos[1], $pos[0], $pos[1] - 30)
    Sleep(20)
    WEnd

    [/autoit]
  • Ok, cool. Danke

    wie tu ich das in eine GUI mit einbauen? das der wert jede sekunde aktuelliesiert wird?
    Geht sowas auch mit dem Farbquellcode? Also das er auch den Farbpixel als hexcode im GUI wieder gibt von dem ort wo die Mouse grade ist?
    Dachte an sowas wie:

    [autoit]

    $pos = MouseGetPos()
    $color = PixelGetColor($pos[0],$pos[1])

    [/autoit]
  • natürlich geht sowas, musst dir einfahc nur ne gui dazu machen

    hatte mir da mal n programm geschrieben um hexwerte von farben zu bekommen und umzuwandeln, ist zwar etwas umfangreicher, aber kannst vllt etwas davon lernen

    Spoiler anzeigen
    [autoit]

    #include <GUIConstants.au3>
    #NoTrayIcon
    HotKeySet("{F10}", "Pixelfarbe")
    Global $maus, $farbe

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

    $Wurm = GUICreate("Colorname", 242, 130, 194, 127)
    GUICtrlCreateGroup("Farbe:", 120, 8, 113, 49)
    GUICtrlCreateGroup("", 8, 56, 225, 65)
    GUICtrlCreateGroup("Rot", 16, 64, 65, 49)
    GUICtrlCreateGroup("Grün", 88, 64, 65, 49)
    GUICtrlCreateGroup("Blau", 160, 64, 65, 49)
    $Rot = GUICtrlCreateInput("0", 25, 81, 48, 25, 0x2001)
    GUICtrlSetLimit(GUICtrlCreateUpdown($Rot), 255, 0)
    $Gruen = GuiCtrlCreateInput("0", 97, 81, 48, 25, 0x2001)
    GUICtrlSetLimit(GUICtrlCreateUpdown($Gruen), 255, 0)
    $Blau = GuiCtrlCreateInput("0", 169, 81, 48, 25, 0x2001)
    GUICtrlSetLimit(GUICtrlCreateUpdown($Blau), 255, 0)
    GUICtrlCreateGroup("Hexwert", 8, 8, 105, 49)
    $Color = GUICtrlCreateInput("", 17, 24, 86, 24)
    GUICtrlSetFont(-1, 10, 400, 0, "MS Sans Serif")
    GUICtrlSetResizing(-1, $GUI_DOCKAUTO)
    GUICtrlCreateGroup("", -99, -99, 1, 1)
    $Graphic = GUICtrlCreateGraphic(128, 24, 94, 21)
    GUISetState(@SW_SHOW)
    WinSetOnTop("Colorname", "", 1)

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

    While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
    Case $GUI_EVENT_CLOSE
    Exit
    Case $Color
    GUICtrlSetBkColor(-1, "0x"&GUICtrlRead($Color))
    GUICtrlSetData( $Rot, Dec(StringLeft(GUICtrlRead($Color), 2)))
    GUICtrlSetData( $Gruen, Dec(StringMid(GUICtrlRead($Color), 3, 2)))
    GUICtrlSetData( $Blau, Dec(StringRight(GUICtrlRead($Color), 2)))
    Case $Rot
    GUICtrlSetData( $Color, StringRight(Hex(Guictrlread($Rot)), 2) & StringRight(Hex(GUICtrlRead($Gruen)), 2) & StringRight(Hex(Guictrlread($Blau)), 2))
    GUICtrlSetBkColor($Graphic, "0x"&GUICtrlRead($Color))
    Case $Gruen
    GUICtrlSetData( $Color, StringRight(Hex(Guictrlread($Rot)), 2) & StringRight(Hex(GUICtrlRead($Gruen)), 2) & StringRight(Hex(Guictrlread($Blau)), 2))
    GUICtrlSetBkColor($Graphic, "0x"&GUICtrlRead($Color))
    Case $Blau
    GUICtrlSetData( $Color, StringRight(Hex(Guictrlread($Rot)), 2) & StringRight(Hex(GUICtrlRead($Gruen)), 2) & StringRight(Hex(Guictrlread($Blau)), 2))
    GUICtrlSetBkColor($Graphic, "0x"&GUICtrlRead($Color))
    EndSwitch
    WEnd

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

    Func Pixelfarbe()
    $maus = MouseGetPos()
    $farbe = PixelGetColor( $maus[0], $maus[1])
    GUICtrlSetData( $Color, StringRight(Hex($farbe), 6))
    GUICtrlSetBkColor($Graphic, "0x"&guictrlread($Color))
    GUICtrlSetData( $Rot, Dec(StringLeft(GUICtrlRead($Color), 2)))
    GUICtrlSetData( $Gruen, Dec(StringMid(GUICtrlRead($Color), 3, 2)))
    GUICtrlSetData( $Blau, Dec(StringRight(GUICtrlRead($Color), 2)))
    EndFunc

    [/autoit]
  • Hast doch einen guten Ansatz hab dir schnell ein Skript gemacht.

    Spoiler anzeigen
    [autoit]

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

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

    $gui = GUICreate("Maus Info", 207, 69, 193, 125)
    $label = GUICtrlCreateLabel("Maus Position:", 8, 8, 73, 17)
    $label_pos = GUICtrlCreateLabel("", 104, 8, 92, 20)
    $label1 = GUICtrlCreateLabel("Farbe unter Maus:", 8, 40, 90, 17)
    $label_farbe = GUICtrlCreateLabel("", 104, 40, 92, 20)
    GUISetState(@SW_SHOW)

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

    AdlibEnable("_Aktualisieren", 1000)

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

    While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
    Case $GUI_EVENT_CLOSE
    Exit
    EndSwitch
    WEnd

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

    Func _Aktualisieren()
    $pos = MouseGetPos()
    $color = PixelGetColor($pos[0],$pos[1])
    GUICtrlSetData($label_pos, "X: " & $pos[0] & " Y: " & $pos[1])
    GUICtrlSetData($label_farbe, "0x" & StringRight(Hex($color), 6))
    GUICtrlSetColor($label_farbe, $color)
    EndFunc

    [/autoit]

    Edit: Bin heute immer zu spät dran^^

    MfG xXTobi93Xx