update 11.03.09 - 14:45
Hallo,
anbei mal ein Tool was ich nun endlich soweit gebracht habe, das man es nutzen kann =)
Es speichert alle Texte, die in die Zwischenablage kopiert werden, in einem Listview, mit Datum und Zeit.
ListView kann über Maus3 ein-/ ausgeblendet werden. Mit ESC lässt sich das Script beenden.
Einzelne Einträge lassen sich mit DEL oder doppelter Rechtsklick löschen, ganzen ListView mit ALT+DEL
Ein Klick auf eine Zeile im ListView kopiert den Text wieder in die Zwischenablage.
Es Fehlen noch einige Sachen, wo ich aber im Moment noch keinen Durchblick habe, wie ich diese am besten umsetze.
- Uhr-Icon in Spalte 2
- Daten aus der Zwischenablage aufnehmen
- Tooltip des gesamtes Textes pro Zeile
Falls noch wer Ideen, Anregungen oder HilfeCode hat, immer her damit =)
Spoiler anzeigen
[autoit]#NoTrayIcon
#Region ;**** Directives created by AutoIt3Wrapper_GUI ****
#AutoIt3Wrapper_icon=..\..\..\Icons\shell32.ico
#EndRegion ;**** Directives created by AutoIt3Wrapper_GUI ****
;vertikale Scrollleiste
#include <Clipboard.au3>
#include <Date.au3>
#include <GuiListView.au3>
#include "O:\AutoIT\Includes\MouseSetOnEvent_UDF.au3"
#include <SendMessage.au3>
#include <GUIConstantsEx.au3>
#include <ListViewConstants.au3>
#include <StructureConstants.au3>
#include <WindowsConstants.au3>
#Include <GuiImageList.au3>
#include <Misc.au3>
#Include <GuiToolTip.au3>
;#include <Events.au3>
Global $iMemo, $hNext = 0, $hGui, $hListView, $hWndFrom, $iCode, $tInfo
_MouseSetOnEvent($MOUSE_WHELLDOWN_EVENT, "_MOUSE_WHELLDOWN_EVENT")
; Create GUI
$hGUI = GUICreate("Clipboard", 415, 176, -1, -1, $WS_POPUPWINDOW, BitOR($WS_EX_TOPMOST, $WS_EX_TOOLWINDOW))
$ListView = GUICtrlCreateListView("Clipboard|Time", 0, 0, 415, 176, BitOR($LVS_NOCOLUMNHEADER,$LVS_REPORT, $LVS_SINGLESEL, $LVS_SHOWSELALWAYS), BitOR($WS_EX_CLIENTEDGE,$LVS_EX_GRIDLINES,$LVS_EX_HEADERDRAGDROP,$LVS_EX_FULLROWSELECT, $LVS_EX_INFOTIP ))
$iMemo = GUICtrlGetHandle($ListView)
$hImage = _GUIImageList_Create(16, 16, 5, 3)
_GUICtrlListView_SetImageList($ListView, $hImage, 1)
_GUIImageList_AddIcon($hImage, @SystemDir & "\shell32.dll", 1)
_GUICtrlListView_SetColumnWidth($iMemo, 0, 291)
_GUICtrlListView_SetColumnWidth($iMemo, 1, 120)
WinSetOnTop($hGUI, "", 1)
;GUISetState()
; Initialize clipboard viewer
$hNext = _ClipBoard_SetViewer ($hGUI)
_GUICtrlListView_SetToolTips($ListView, _GUICtrlListView_GetToolTips($ListView))
$hToolTip = _GUIToolTip_Create($iMemo, BitOR($TTS_ALWAYSTIP, $TTS_BALLOON, $TTS_CLOSE))
_GUIToolTip_SetDelayTime($hToolTip, 0, 1000)
GUIRegisterMsg($WM_NOTIFY, "WM_NOTIFY")
GUIRegisterMsg($WM_CHANGECBCHAIN, "WM_CHANGECBCHAIN")
GUIRegisterMsg($WM_DRAWCLIPBOARD, "WM_DRAWCLIPBOARD")
; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE
; Shut down clipboard viewer
_ClipBoard_ChangeChain ($hGUI, $hNext)
Func _MOUSE_WHELLDOWN_EVENT()
$MousePos = MouseGetPos( )
$State = WinGetState($hGUI)
If $State = 15 Or $State = 7 Then
WinSetState($hGUI, "", @SW_HIDE)
ElseIf $State = 23 Then
WinMove($hGUI, "", $MousePos[0], $MousePos[1])
WinSetState($hGUI, "", @SW_SHOW)
WinActivate($hGUI)
Else
WinMove($hGUI, "", $MousePos[0], $MousePos[1])
WinSetState($hGUI, "", @SW_SHOW)
WinActivate($hGUI)
EndIf
EndFunc
; Write message to memo
Func MemoWrite($sMessage = "")
If $sMessage <> "" And WinGetHandle("") <> $hGui Then
_GUICtrlListView_InsertItem($iMemo, $sMessage, 0, 0)
;_GUICtrlListView_AddItem($iMemo, $sMessage)
;~ _GUICtrlListView_AddSubItem($iMemo, 0, _now(), 1, 1)
_GUICtrlListView_SetItemText($iMemo, 0, _now(), 1)
;~ _GUICtrlListView_SetItemImage($iMemo, 0, 0, 1)
EndIf
EndFunc ;==>MemoWrite
; Handle $WM_CHANGECBCHAIN messages
Func WM_CHANGECBCHAIN($hWnd, $iMsg, $iwParam, $ilParam)
; Show that message was received
MemoWrite("***** $WM_CHANGECBCHAIN *****")
; If the next window is closing, repair the chain
If $iwParam = $hNext Then
$hNext = $ilParam
; Otherwise pass the message to the next viewer
ElseIf $hNext <> 0 Then
_SendMessage ($hNext, $WM_CHANGECBCHAIN, $iwParam, $ilParam, 0, "hwnd", "hwnd")
EndIf
EndFunc ;==>WM_CHANGECBCHAIN
; Handle $WM_DRAWCLIPBOARD messages
Func WM_DRAWCLIPBOARD($hWnd, $iMsg, $iwParam, $ilParam)
; Display any text on clipboard
MemoWrite(_ClipBoard_GetData ())
; Pass the message to the next viewer
If $hNext <> 0 Then _SendMessage ($hNext, $WM_DRAWCLIPBOARD, $iwParam, $ilParam)
EndFunc ;==>WM_DRAWCLIPBOARD
Func WM_NOTIFY($hWnd, $iMsg, $iwParam, $ilParam)
#forceref $hWnd, $iMsg, $iwParam
Local $hWndFrom, $iIDFrom, $iCode, $tNMHDR, $hWndListView, $tInfo
;~ Local $tBuffer
$hWndListView = $iMemo
If Not IsHWnd($iMemo) Then $hWndListView = GUICtrlGetHandle($hListView)
$tNMHDR = DllStructCreate($tagNMHDR, $ilParam)
$hWndFrom = HWnd(DllStructGetData($tNMHDR, "hWndFrom"))
$iIDFrom = DllStructGetData($tNMHDR, "IDFrom")
$iCode = DllStructGetData($tNMHDR, "Code")
Switch $hWndFrom
Case $hWndListView
Switch $iCode
Case $LVN_HOTTRACK ; Sent by a list-view control when the user moves the mouse over an item
$tInfo = DllStructCreate($tagNMLISTVIEW, $ilParam)
$gText = _GUICtrlListView_GetItemText($hWndFrom, DllStructGetData($tInfo, "Index"), 0)
_GUIToolTip_Activate($hWndFrom)
_GUIToolTip_PopUp($hWndFrom)
_GUIToolTip_UpdateTipText($hWndFrom, $hToolTip, -1, $gText)
;Return 0 ; allow the list view to perform its normal track select processing.
Return 1 ; the item will not be selected.
; No return value
Case $LVN_ITEMACTIVATE ; Sent by a list-view control when the user activates an item
$tInfo = DllStructCreate($tagNMITEMACTIVATE, $ilParam)
$gText = _GUICtrlListView_GetItemText($hWndFrom, DllStructGetData($tInfo, "Index"), 0)
ClipPut($gText)
Return 0
Case $NM_CLICK ; Sent by a list-view control when the user clicks an item with the left mouse button
$tInfo = DllStructCreate($tagNMITEMACTIVATE, $ilParam)
$gText = _GUICtrlListView_GetItemText($hWndFrom, DllStructGetData($tInfo, "Index"), 0)
ClipPut($gText)
Case $NM_DBLCLK ; Sent by a list-view control when the user double-clicks an item with the left mouse button
$tInfo = DllStructCreate($tagNMITEMACTIVATE, $ilParam)
$gText = _GUICtrlListView_GetItemText($hWndFrom, DllStructGetData($tInfo, "Index"), 0)
Case $NM_HOVER ; Sent by a list-view control when the mouse hovers over an item
$gText = _GUICtrlListView_GetItemText($hWndFrom, DllStructGetData($tInfo, "Index"), 0)
;Return 0 ; process the hover normally
Return 1 ; prevent the hover from being processed
; No return value
Case $NM_RCLICK ; Sent by a list-view control when the user clicks an item with the right mouse button
$tInfo = DllStructCreate($tagNMITEMACTIVATE, $ilParam)
$gText = _GUICtrlListView_GetItemText($hWndFrom, DllStructGetData($tInfo, "Index"), 0)
Case $NM_RDBLCLK ; Sent by a list-view control when the user double-clicks an item with the right mouse button
$tInfo = DllStructCreate($tagNMLVKEYDOWN, $ilParam)
_GUICtrlListView_DeleteItem($hWndFrom, _GUICtrlListView_GetSelectedIndices($hWndFrom))
ClipPut("")
; No return value
Case $LVN_KEYDOWN ; A key has been pressed
$tInfo = DllStructCreate($tagNMLVKEYDOWN, $ilParam)
Select
Case _IsPressed("2E") And _IsPressed("2E")
_GUICtrlListView_DeleteAllItems($hWndFrom)
ClipPut("")
Case _IsPressed("2E")
_GUICtrlListView_DeleteItem($hWndFrom, _GUICtrlListView_GetSelectedIndices($hWndFrom))
ClipPut("")
EndSelect
EndSwitch
EndSwitch
Return $GUI_RUNDEFMSG
EndFunc ;==>WM_NOTIFY
Func _DebugPrint($s_text, $line = @ScriptLineNumber)
ConsoleWrite( _
"!===========================================================" & @LF & _
"+======================================================" & @LF & _
"-->Line(" & StringFormat("%04d", $line) & "):" & @TAB & $s_text & @LF & _
"+======================================================" & @LF)
EndFunc ;==>_DebugPrint/autoit]