Clipboard Dokumentation

  • Hey Leute

    ich würde gerne ein Programm machen, das die Clipboard Einträge speichert und später wieder in die Zwischenablage legt.

    1.) Warum funktioniert meine Funktion nicht? (z.17-20)

    2.) Wie kann ich die einzelnen ListView Einträge per doppelklick wieder in die Zwischenablage versetzen? (hauptsächlich geht es um den Doppelklick!)

    Hier das was ich bis jetzt habe:

    Spoiler anzeigen
    [autoit]

    #include <GuiConstants.au3>
    HotKeySet("{F11}","_hideShow")
    $aktuellerclip = ClipGet()
    Global $hotkey = 1
    GUICreate("Clip Manager",300,500)
    $list = GUICtrlCreateList($aktuellerclip,10,10,280,480)
    GUISetState(@SW_HIDE)
    While 1
    $neuerclip = ClipGet()
    $nMsg = GUIGetMsg()
    Select
    Case $nMsg = $GUI_EVENT_CLOSE
    Exit
    EndSelect
    If Not $aktuellerclip = $neuerclip Then
    $aktuellerclip = $neuerclip
    GUICtrlSetData($list,$aktuellerclip)
    EndIf
    WEnd
    Func _hideShow()
    If $hotkey = 1 Then
    GUISetState(@SW_SHOW)
    $hotkey = $hotkey*-1
    Else
    GUISetState(@SW_HIDE)
    $hotkey = $hotkey*-1
    EndIf
    EndFunc

    [/autoit]
    • Offizieller Beitrag

    Du meintest statt Listview eine Listbox.
    Hier ein Bsp.:

    Spoiler anzeigen
    [autoit]

    #include <FontConstants.au3>
    #include <WinAPI.au3>
    #include <GUIConstantsEx.au3>
    #include <ListBoxConstants.au3>
    #include <WindowsConstants.au3>
    #include <GUIListBox.au3>
    ; cType:
    Global Const $ODT_LISTBOX = 0x0002
    ; itmAction:
    Global Const $ODA_DRAWENTIRE = 0x0001
    Global Const $ODA_SELECT = 0x0002
    Global Const $ODA_FOCUS = 0x0004
    ; itmState:
    Global Const $ODS_SELECTED = 0x0001
    Global Const $ODS_GRAYED = 0x0002
    Global Const $ODS_FOCUS = 0x0010
    Global Const $ODS_DEFAULT = 0x0020
    Global Const $ODS_INACTIVE = 0x0080

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

    Global $eventCount = 0
    Global $aColTabItem[2] = [0x11AADD,0xEEBB99] ; Item-Color

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

    $hGUI = GUICreate("List Box Create", 400, 296)
    $bt_mark = GUICtrlCreateButton('Markierung aufheben', 140, 5, 120, 20)
    $ListBox = GUICtrlCreateList('', 2, 30, 396, 268, BitOR($LBS_STANDARD, $LBS_EXTENDEDSEL))
    $hListBox = GUICtrlGetHandle($ListBox)
    _GUICtrlListBox_BeginUpdate($hListBox)
    For $iI = 1 To 20
    _GUICtrlListBox_AddString($hListBox, StringFormat("%03d : Random string", Random(1, 100, 1)))
    Next
    _GUICtrlListBox_EndUpdate($hListBox)

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

    GUIRegisterMsg($WM_COMMAND, "WM_COMMAND")

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

    GUISetState(@SW_SHOW, $hGUI)

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

    While True
    $msg = GUIGetMsg()
    Switch $msg
    Case $GUI_EVENT_CLOSE
    Exit
    Case $bt_mark
    $index = _GUICtrlListBox_GetSelItems($hListBox)
    If UBound($index) > 1 Then _GUICtrlListBox_SetSel($hListBox, $index[1])
    EndSwitch
    WEnd

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

    Func _ShowEvent($Event)
    $eventCount += 1
    WinSetTitle($hGUI, '', '[' & $eventCount & '] Event: >> ' & $Event & ' <<')
    EndFunc

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

    Func WM_COMMAND($hWnd, $iMsg, $iwParam, $ilParam)
    Local $hWndFrom, $iIDFrom, $iCode, $hWndListBox
    If Not IsHWnd($hListBox) Then $hWndListBox = GUICtrlGetHandle($hListBox)
    $hWndFrom = $ilParam
    $iIDFrom = BitAND($iwParam, 0xFFFF) ; Low Word
    $iCode = BitShift($iwParam, 16) ; Hi Word

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

    Switch $hWndFrom
    Case $hListBox, $hWndListBox
    Switch $iCode
    Case $LBN_DBLCLK ; Sent when the user double-clicks a string in a list box
    _ShowEvent('Doppelklick')
    Case $LBN_ERRSPACE ; Sent when a list box cannot allocate enough memory to meet a specific request
    _ShowEvent('Speicherproblem')
    Case $LBN_KILLFOCUS ; Sent when a list box loses the keyboard focus
    _ShowEvent('Focus verloren')
    Case $LBN_SELCANCEL ; Sent when the user cancels the selection in a list box
    _ShowEvent('Auswahl aufgehoben')
    Case $LBN_SELCHANGE ; Sent when the selection in a list box has changed
    _ShowEvent('Auswahl verändert')
    Case $LBN_SETFOCUS ; Sent when a list box receives the keyboard focus
    _ShowEvent('Focus erhalten')
    EndSwitch
    EndSwitch
    Return $GUI_RUNDEFMSG
    EndFunc ;==>WM_COMMAND

    [/autoit]
  • ersetz mal

    [autoit]

    If Not $aktuellerclip = $neuerclip Then

    [/autoit]


    mit

    [autoit]

    If StringCompare( $aktuellerclip , $neuerclip) <> 0 Then

    [/autoit]

    Etwas in die Zwischenablage einfügen geht mit

    [autoit]

    clipput()

    [/autoit]

    Bezüglich Listbox und Doppelklick siehe Bugfix.

  • wow danke misterspeed;) jetzt funktioniert schonmal das eintragen

    so hab das programm fertig;)

    meint ihr ich soll dazu noch nen skripteforum beitrag erstellen weil ich find das programm ziemlich praktisch wenn man mal ausversehen was falsches kopiert hat