• Hi Leute,
    ich habe mal eine Funktion geschrieben die sich Pipette nennt.
    Die Funktion verwende ich dafür um den Farbwert in Hex an der Stelle auszulesen, an der ich mit der linken Maustaste klicke.
    Das ist gerade in der Webentwicklung super wenn es um die Farbgestaltung geht.

    Dann wird ein TayTip mit dem Wert angezeigt und der Wert wird in die Zwischenablage kopiert.

    Mit den Parametern $copy, $tray und $timeout kann ich noch ein paar Optionen festlegen.
    - nicht in die Zwischenablage kopieren.
    - kein TrayTip anzeigen.
    - wie lange das TayTip angezeigt werden soll.

    So hier die Funktion.

    Spoiler anzeigen
    [autoit]


    ;#INDEX# ======================================================================
    ; Title .........: Pipette
    ; AutoIt Version : 3.3.0++
    ; Language ......: English
    ; Description ...: Functions for get Pixelcolor on Mouseposition.
    ; Author(s) .....: Der_Doc
    ; Dll(s) ........: user32.dll
    ; Includes ......: Misc.au3
    ; ==============================================================================

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

    ; #FUNCTION# ===================================================================
    ; Name...........: _Pipette
    ; Description ...: Get Pixelcolor on Mouseposition
    ; Syntax.........: _Pipette(ClipPut = True, TrayTip = True,timeout)
    ; Parameters ....: ClipPut = True - Put the value to Clipboard [Optional] default True
    ; TrayTip = True - Show TrayTip with value [Optional] default True
    ; timeout (in milliseconds) for show TrayTip [Optional] default 5000 (5Sec)
    ; Return values .: Returns the colorvalue
    ; Author ........: Der_Doc
    ; Modified ......:
    ; Remarks .......: Calling this function for get the Pixelcolor on Mouse Courser Position
    ; ==============================================================================

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

    Func _Pipette($fcopy = True,$ftray = True,$ftimeout = 5000)
    Local $dll
    Local $pos

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

    $dll = DllOpen("user32.dll")
    While 1
    If _IsPressed("01", $dll) Then
    $pos = MouseGetPos()

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

    if ($fcopy = True) then
    ClipPut(Hex(PixelGetColor( $pos[0],$pos[1]), 6))
    EndIf
    if (($ftray = True) AND ($fcopy = True))then
    TrayTip("The Colorvalue is copied to the Clipboard.", Hex(PixelGetColor( $pos[0],$pos[1]), 6), 5, 1)
    Sleep($ftimeout)
    EndIf
    if (($ftray = True) AND ($fcopy = False))then
    TrayTip("The Colorvalue is.", Hex(PixelGetColor( $pos[0],$pos[1]), 6), 5, 1)
    Sleep($ftimeout)
    EndIf
    Return Hex(PixelGetColor( $pos[0],$pos[1]),6)
    ExitLoop
    EndIf
    WEnd
    DllClose($dll)
    EndFunc

    [/autoit]

    Hier ein Beispiel:

    Spoiler anzeigen
    [autoit]


    #include <Misc.au3>
    Dim $Pixelcolor

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

    $Pixelcolor = _Pipette(True,True,1000) ;timeout 1000 sec
    MsgBox(0,"Pixelcolor",$Pixelcolor)

    [/autoit]

    Hier noch ein Icon zum Programm


    Bitte teilt mir mal mit ob Euch die Funktion brauchbar erscheint und ob es noch Fehler gibt.

    MfG
    Der_Doc

  • Schöne Funktion.
    Nützlich ist hier wohl Situationsbedingt.
    Ich glaube, dass das Script wirklich gut ist für die Webentwicklung, oder wenn man Photoshop kopieren will :D
    Aber es heißt nicht
    The Colorvalue is copy to Clipboard.
    Sondern:
    The Colorvalue is copied <-- to the <--Clipboard.
    Ansonsten, super Funktion :thumbup:

    Meine Projekte:
    ClipBoard Manager (beendet)
    Gutes ClipBoard Verwaltungs Programm mit nützlichen Funktionen.

    HTML Creator (beendet)
    Nützliches Tool um schnell ein eigenes HTML Dokument zu erstellen.