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
;#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
; ==============================================================================
; #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
; ==============================================================================
Func _Pipette($fcopy = True,$ftray = True,$ftimeout = 5000)
Local $dll
Local $pos
$dll = DllOpen("user32.dll")
While 1
If _IsPressed("01", $dll) Then
$pos = MouseGetPos()
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
Hier ein Beispiel:
Spoiler anzeigen
#include <Misc.au3>
Dim $Pixelcolor
$Pixelcolor = _Pipette(True,True,1000) ;timeout 1000 sec
MsgBox(0,"Pixelcolor",$Pixelcolor)
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