Jump to content
CaptainSparky

Clipper - Clipboard manager

Recommended Posts

CaptainSparky

Hello.

I have designed and created a simple Clipboard manager in AutoIt. The project is open for any ideas, I hope you found it useful (and if you did please like my post so I can continue making software).

Features

[Done] Can store data in up to 5 slots.

[Done] Options form.

[Done] System Tray menu.

[Done] Supports Hot-keys when pasting/copying data.

[Done] Ability to copy and store text.

[Done] Clipper theme.

[Coming soon] Ability to copy and store files and folders.

[Coming soon] Clipboard history form. ( currently logs history into a text file )

And Much Much More!

Source

; Clipper - Clipboard manager
; Created by TheNewHunter/TheNewGuy
; Version 0.3553
; PLEASE leave a like on the post and I will make more software!

;@#############################################################@
;# Configuration # Configuration # Configuration # Configurati #
;#                                                             #
$FormName = "Clipper" ;The form's name                        ;#
$FormNameOptions = "Options" ; The options form name          ;#
;#                                                             #
;# Configuration # Configuration # Configuration # Configurati #
;@#############################################################@

Opt("TrayMenuMode", 3) ;Don't touch unless you understand. [Function: Hides the default AutoIt system tray menu.]

$tbOptions = TrayCreateItem("Options")
TrayCreateItem("")
$tbExit = TrayCreateItem("Exit " & $FormName)
$ClipboardLogging = "true"

#include <GUIConstantsEx.au3>;Don't touch unless you understand. [Function: Include the required library(s).]
#include <WindowsConstants.au3>;Don't touch unless you understand. [Function: Include the required library(s).]
#include <TrayConstants.au3>;Don't touch unless you understand. [Function: Include the required library(s).]
#include <ButtonConstants.au3>;Don't touch unless you understand. [Function: Include the required library(s).]
#include <ComboConstants.au3>;Don't touch unless you understand. [Function: Include the required library(s).]
#include <EditConstants.au3>;Don't touch unless you understand. [Function: Include the required library(s).]
#include <StaticConstants.au3>;Don't touch unless you understand. [Function: Include the required library(s).]
#include <file.au3>;Don't touch unless you understand. [Function: Include the required library(s).]

If Not FileExists(@ScriptDir & "\Clipboard Logging.txt") Then
    _FileCreate(@ScriptDir & "\Clipboard Logging.txt")
EndIf

HotKeySet("^c", "ClipperActivateCopy")
HotKeySet("^v", "ClipperActivatePaste")
$Form = GUICreate($FormName, 170, 170, 192, 146, BitOR($WS_POPUP, $WS_CAPTION))
$bClipper1 = GUICtrlCreateButton("Save", 16, 8, 137, 25)
$bClipper2 = GUICtrlCreateButton("Save", 16, 40, 137, 25)
$bClipper3 = GUICtrlCreateButton("Save", 16, 72, 137, 25)
$bClipper4 = GUICtrlCreateButton("Save", 16, 104, 137, 25)
$bClipper5 = GUICtrlCreateButton("Save", 16, 136, 137, 25)
GUISetState(@SW_HIDE)

Global $GottenClipboard
Global $ClipperData[5]
Global $ClipperPopulation[5]
Global $LoopLock = "false"
Global $ClipboardLogging

$ClipperPopulation[0] = "empty"
$ClipperPopulation[1] = "empty"
$ClipperPopulation[2] = "empty"
$ClipperPopulation[3] = "empty"
$ClipperPopulation[4] = "empty"

Main()

Func Main()
    While 1
        Switch TrayGetMsg()
            Case $tbExit
                Exit
            Case $tbOptions
                tbOptions()
        EndSwitch
    WEnd
EndFunc   ;==>Main

Func ClipperActivateCopy()
    HotKeySet("1", "HotKeyCopy1")
    HotKeySet("2", "HotKeyCopy2")
    HotKeySet("3", "HotKeyCopy3")
    HotKeySet("4", "HotKeyCopy4")
    HotKeySet("5", "HotKeyCopy5")
    HotKeySet("^c")
    Send("^c")
    HotKeySet("^c", "ClipperActivateCopy")
    $GottenClipboard = ClipGet()
    $MousePos = MouseGetPos()
    WinMove($FormName, "", $MousePos[0], $MousePos[1])
    WinActivate($FormName)
    ControlEnable($FormName, "", $bClipper1)
    ControlEnable($FormName, "", $bClipper2)
    ControlEnable($FormName, "", $bClipper3)
    ControlEnable($FormName, "", $bClipper4)
    ControlEnable($FormName, "", $bClipper5)

    If $ClipperPopulation[0] = "true" Then
        $StringLenght0 = StringLen($ClipperData[0])
        $TrimedString0 = StringTrimRight($ClipperData[0], $StringLenght0 - 10)
        GUICtrlSetData($bClipper1, "Replace " & $TrimedString0 & "..")
    Else
        GUICtrlSetData($bClipper1, "Save")
    EndIf

    If $ClipperPopulation[1] = "true" Then
        $StringLenght1 = StringLen($ClipperData[1])
        $TrimedString1 = StringTrimRight($ClipperData[1], $StringLenght1 - 10)
        GUICtrlSetData($bClipper2, "Replace " & $TrimedString1 & "..")
    Else
        GUICtrlSetData($bClipper2, "Save")
    EndIf

    If $ClipperPopulation[2] = "true" Then
        $StringLenght2 = StringLen($ClipperData[2])
        $TrimedString2 = StringTrimRight($ClipperData[2], $StringLenght2 - 10)
        GUICtrlSetData($bClipper3, "Replace " & $TrimedString2 & "..")
    Else
        GUICtrlSetData($bClipper3, "Save")
    EndIf

    If $ClipperPopulation[3] = "true" Then
        $StringLenght3 = StringLen($ClipperData[3])
        $TrimedString3 = StringTrimRight($ClipperData[3], $StringLenght3 - 10)
        GUICtrlSetData($bClipper4, "Replace " & $TrimedString3 & "..")
    Else
        GUICtrlSetData($bClipper4, "Save")
    EndIf

    If $ClipperPopulation[4] = "true" Then
        $StringLenght4 = StringLen($ClipperData[4])
        $TrimedString4 = StringTrimRight($ClipperData[4], $StringLenght4 - 10)
        GUICtrlSetData($bClipper5, "Replace " & $TrimedString4 & "..")
    Else
        GUICtrlSetData($bClipper5, "Save")
    EndIf

    GUISetState(@SW_SHOW)

    While 1
        If Not WinActive($FormName) Then
            GUISetState(@SW_HIDE)
            Main()
        EndIf
        $nMsg = GUIGetMsg()
        Switch $nMsg
            Case $GUI_EVENT_CLOSE
                Exit
            Case $bClipper1
                GUISetState(@SW_HIDE)
                $ClipperData[0] = $GottenClipboard
                $ClipperPopulation[0] = "true"
                If $ClipboardLogging = "true" Then
                    $GottenClipboard2 = ClipGet()
                    FileWriteLine(@ScriptDir & "\Clipboard Logging.txt", "[" & @MON & "/" & @MDAY & "/" & @YEAR & "][" & @HOUR & ":" & @MIN & ":" & @SEC & "] [Copied] " & $GottenClipboard2)
                EndIf
                Main()
            Case $bClipper2
                GUISetState(@SW_HIDE)
                $ClipperData[1] = $GottenClipboard
                $ClipperPopulation[1] = "true"
                If $ClipboardLogging = "true" Then
                    $GottenClipboard2 = ClipGet()
                    FileWriteLine(@ScriptDir & "\Clipboard Logging.txt", "[" & @MON & "/" & @MDAY & "/" & @YEAR & "][" & @HOUR & ":" & @MIN & ":" & @SEC & "] [Copied] " & $GottenClipboard2)
                EndIf
                Main()
            Case $bClipper3
                GUISetState(@SW_HIDE)
                $ClipperData[2] = $GottenClipboard
                $ClipperPopulation[2] = "true"
                If $ClipboardLogging = "true" Then
                    $GottenClipboard2 = ClipGet()
                    FileWriteLine(@ScriptDir & "\Clipboard Logging.txt", "[" & @MON & "/" & @MDAY & "/" & @YEAR & "][" & @HOUR & ":" & @MIN & ":" & @SEC & "] [Copied] " & $GottenClipboard2)
                EndIf
                Main()
            Case $bClipper4
                GUISetState(@SW_HIDE)
                $ClipperData[3] = $GottenClipboard
                $ClipperPopulation[3] = "true"
                If $ClipboardLogging = "true" Then
                    $GottenClipboard2 = ClipGet()
                    FileWriteLine(@ScriptDir & "\Clipboard Logging.txt", "[" & @MON & "/" & @MDAY & "/" & @YEAR & "][" & @HOUR & ":" & @MIN & ":" & @SEC & "] [Copied] " & $GottenClipboard2)
                EndIf
                Main()
            Case $bClipper5
                GUISetState(@SW_HIDE)
                $ClipperData[4] = $GottenClipboard
                $ClipperPopulation[4] = "true"
                If $ClipboardLogging = "true" Then
                    $GottenClipboard2 = ClipGet()
                    FileWriteLine(@ScriptDir & "\Clipboard Logging.txt", "[" & @MON & "/" & @MDAY & "/" & @YEAR & "][" & @HOUR & ":" & @MIN & ":" & @SEC & "] [Copied] " & $GottenClipboard2)
                EndIf
                Main()
        EndSwitch
        Switch TrayGetMsg()
            Case $tbExit
                Exit
            Case $tbOptions
                tbOptions()
        EndSwitch
    WEnd
EndFunc   ;==>ClipperActivateCopy

Func HotKeyCopy1()
    HotKeySet("1")
    GUISetState(@SW_HIDE)
    $ClipperData[0] = $GottenClipboard
    $ClipperPopulation[0] = "true"
    If $ClipboardLogging = "true" Then
        $GottenClipboard2 = ClipGet()
        FileWriteLine(@ScriptDir & "\Clipboard Logging.txt", "[" & @MON & "/" & @MDAY & "/" & @YEAR & "][" & @HOUR & ":" & @MIN & ":" & @SEC & "] [Copied] " & $GottenClipboard2)
    EndIf
    Main()
EndFunc   ;==>HotKeyCopy1

Func HotKeyCopy2()
    HotKeySet("2")
    GUISetState(@SW_HIDE)
    $ClipperData[1] = $GottenClipboard
    $ClipperPopulation[1] = "true"
    If $ClipboardLogging = "true" Then
        $GottenClipboard2 = ClipGet()
        FileWriteLine(@ScriptDir & "\Clipboard Logging.txt", "[" & @MON & "/" & @MDAY & "/" & @YEAR & "][" & @HOUR & ":" & @MIN & ":" & @SEC & "] [Copied] " & $GottenClipboard2)
    EndIf
    Main()
EndFunc   ;==>HotKeyCopy2

Func HotKeyCopy3()
    HotKeySet("3")
    GUISetState(@SW_HIDE)
    $ClipperData[2] = $GottenClipboard
    $ClipperPopulation[2] = "true"
    If $ClipboardLogging = "true" Then
        $GottenClipboard2 = ClipGet()
        FileWriteLine(@ScriptDir & "\Clipboard Logging.txt", "[" & @MON & "/" & @MDAY & "/" & @YEAR & "][" & @HOUR & ":" & @MIN & ":" & @SEC & "] [Copied] " & $GottenClipboard2)
    EndIf
    Main()
EndFunc   ;==>HotKeyCopy3

Func HotKeyCopy4()
    HotKeySet("4")
    GUISetState(@SW_HIDE)
    $ClipperData[3] = $GottenClipboard
    $ClipperPopulation[3] = "true"
    If $ClipboardLogging = "true" Then
        $GottenClipboard2 = ClipGet()
        FileWriteLine(@ScriptDir & "\Clipboard Logging.txt", "[" & @MON & "/" & @MDAY & "/" & @YEAR & "][" & @HOUR & ":" & @MIN & ":" & @SEC & "] [Copied] " & $GottenClipboard2)
    EndIf
    Main()
EndFunc   ;==>HotKeyCopy4

Func HotKeyCopy5()
    HotKeySet("5")
    GUISetState(@SW_HIDE)
    $ClipperData[4] = $GottenClipboard
    $ClipperPopulation[4] = "true"
    If $ClipboardLogging = "true" Then
        $GottenClipboard2 = ClipGet()
        FileWriteLine(@ScriptDir & "\Clipboard Logging.txt", "[" & @MON & "/" & @MDAY & "/" & @YEAR & "][" & @HOUR & ":" & @MIN & ":" & @SEC & "] [Copied] " & $GottenClipboard2)
    EndIf
    Main()
EndFunc   ;==>HotKeyCopy5

Func ClipperActivatePaste()
    HotKeySet("1", "HotKeyPaste1")
    HotKeySet("2", "HotKeyPaste2")
    HotKeySet("3", "HotKeyPaste3")
    HotKeySet("4", "HotKeyPaste4")
    HotKeySet("5", "HotKeyPaste5")
    $MousePos = MouseGetPos()
    WinMove($FormName, "", $MousePos[0], $MousePos[1])
    WinActivate($FormName)

    If $ClipperPopulation[0] = "true" Then
        $StringLenght0 = StringLen($ClipperData[0])
        $TrimedString0 = StringTrimRight($ClipperData[0], $StringLenght0 - 10)
        GUICtrlSetData($bClipper1, "Paste " & $TrimedString0 & "..")
    Else
        GUICtrlSetData($bClipper1, "Empty")
        ControlDisable($FormName, "", $bClipper1)
    EndIf
    If $ClipperPopulation[1] = "true" Then
        $StringLenght1 = StringLen($ClipperData[1])
        $TrimedString1 = StringTrimRight($ClipperData[1], $StringLenght1 - 10)
        GUICtrlSetData($bClipper2, "Paste " & $TrimedString1 & "..")
    Else
        GUICtrlSetData($bClipper2, "Empty")
        ControlDisable($FormName, "", $bClipper2)
    EndIf
    If $ClipperPopulation[2] = "true" Then
        $StringLenght2 = StringLen($ClipperData[2])
        $TrimedString2 = StringTrimRight($ClipperData[2], $StringLenght2 - 10)
        GUICtrlSetData($bClipper3, "Paste " & $TrimedString2 & "..")
    Else
        GUICtrlSetData($bClipper3, "Empty")
        ControlDisable($FormName, "", $bClipper3)
    EndIf
    If $ClipperPopulation[3] = "true" Then
        $StringLenght3 = StringLen($ClipperData[3])
        $TrimedString3 = StringTrimRight($ClipperData[3], $StringLenght3 - 10)
        GUICtrlSetData($bClipper4, "Paste " & $TrimedString3 & "..")
    Else
        GUICtrlSetData($bClipper4, "Empty")
        ControlDisable($FormName, "", $bClipper4)
    EndIf
    If $ClipperPopulation[4] = "true" Then
        $StringLenght4 = StringLen($ClipperData[4])
        $TrimedString4 = StringTrimRight($ClipperData[4], $StringLenght4 - 10)
        GUICtrlSetData($bClipper5, "Paste " & $TrimedString4 & "..")
    Else
        GUICtrlSetData($bClipper5, "Empty")
        ControlDisable($FormName, "", $bClipper5)
    EndIf

    GUISetState(@SW_SHOW)

    While 1
        If Not WinActive($FormName) Then
            GUISetState(@SW_HIDE)
            Main()
        EndIf
        $nMsg = GUIGetMsg()
        Switch $nMsg
            Case $GUI_EVENT_CLOSE
                Exit
            Case $bClipper1
                GUISetState(@SW_HIDE)
                ClipPut($ClipperData[0])
                HotKeySet("^v")
                Send("^v")
                HotKeySet("^v", "ClipperActivatePaste")
                If $ClipboardLogging = "true" Then
                    $GottenClipboard2 = ClipGet()
                    FileWriteLine(@ScriptDir & "\Clipboard Logging.txt", "[" & @MON & "/" & @MDAY & "/" & @YEAR & "][" & @HOUR & ":" & @MIN & ":" & @SEC & "] [Pasted] " & $GottenClipboard2)
                EndIf
                Main()
            Case $bClipper2
                GUISetState(@SW_HIDE)
                ClipPut($ClipperData[1])
                HotKeySet("^v")
                Send("^v")
                HotKeySet("^v", "ClipperActivatePaste")
                If $ClipboardLogging = "true" Then
                    $GottenClipboard2 = ClipGet()
                    FileWriteLine(@ScriptDir & "\Clipboard Logging.txt", "[" & @MON & "/" & @MDAY & "/" & @YEAR & "][" & @HOUR & ":" & @MIN & ":" & @SEC & "] [Pasted] " & $GottenClipboard2)
                EndIf
                Main()
            Case $bClipper3
                GUISetState(@SW_HIDE)
                ClipPut($ClipperData[2])
                HotKeySet("^v")
                Send("^v")
                HotKeySet("^v", "ClipperActivatePaste")
                If $ClipboardLogging = "true" Then
                    $GottenClipboard2 = ClipGet()
                    FileWriteLine(@ScriptDir & "\Clipboard Logging.txt", "[" & @MON & "/" & @MDAY & "/" & @YEAR & "][" & @HOUR & ":" & @MIN & ":" & @SEC & "] [Pasted] " & $GottenClipboard2)
                EndIf
                Main()
            Case $bClipper4
                GUISetState(@SW_HIDE)
                ClipPut($ClipperData[3])
                HotKeySet("^v")
                Send("^v")
                HotKeySet("^v", "ClipperActivatePaste")
                If $ClipboardLogging = "true" Then
                    $GottenClipboard2 = ClipGet()
                    FileWriteLine(@ScriptDir & "\Clipboard Logging.txt", "[" & @MON & "/" & @MDAY & "/" & @YEAR & "][" & @HOUR & ":" & @MIN & ":" & @SEC & "] [Pasted] " & $GottenClipboard2)
                EndIf
                Main()
            Case $bClipper5
                GUISetState(@SW_HIDE)
                ClipPut($ClipperData[4])
                HotKeySet("^v")
                Send("^v")
                HotKeySet("^v", "ClipperActivatePaste")
                If $ClipboardLogging = "true" Then
                    $GottenClipboard2 = ClipGet()
                    FileWriteLine(@ScriptDir & "\Clipboard Logging.txt", "[" & @MON & "/" & @MDAY & "/" & @YEAR & "][" & @HOUR & ":" & @MIN & ":" & @SEC & "] [Pasted] " & $GottenClipboard2)
                EndIf
                Main()
        EndSwitch
        Switch TrayGetMsg()
            Case $tbExit
                Exit
            Case $tbOptions
                tbOptions()
        EndSwitch
    WEnd
EndFunc   ;==>ClipperActivatePaste

Func HotKeyPaste1()
    GUISetState(@SW_HIDE)
    ClipPut($ClipperData[0])
    HotKeySet("^v")
    Send("^v")
    HotKeySet("^v", "ClipperActivatePaste")
    If $ClipboardLogging = "true" Then
        $GottenClipboard2 = ClipGet()
        FileWriteLine(@ScriptDir & "\Clipboard Logging.txt", "[" & @MON & "/" & @MDAY & "/" & @YEAR & "][" & @HOUR & ":" & @MIN & ":" & @SEC & "] [Pasted] " & $GottenClipboard2)
    EndIf
    HotKeySet("1")
    Main()
EndFunc   ;==>HotKeyPaste1

Func HotKeyPaste2()
    GUISetState(@SW_HIDE)
    ClipPut($ClipperData[1])
    HotKeySet("^v")
    Send("^v")
    HotKeySet("^v", "ClipperActivatePaste")
    If $ClipboardLogging = "true" Then
        $GottenClipboard2 = ClipGet()
        FileWriteLine(@ScriptDir & "\Clipboard Logging.txt", "[" & @MON & "/" & @MDAY & "/" & @YEAR & "][" & @HOUR & ":" & @MIN & ":" & @SEC & "] [Pasted] " & $GottenClipboard2)
    EndIf
    HotKeySet("2")
    Main()
EndFunc   ;==>HotKeyPaste2

Func HotKeyPaste3()
    GUISetState(@SW_HIDE)
    ClipPut($ClipperData[2])
    HotKeySet("^v")
    Send("^v")
    HotKeySet("^v", "ClipperActivatePaste")
    If $ClipboardLogging = "true" Then
        $GottenClipboard2 = ClipGet()
        FileWriteLine(@ScriptDir & "\Clipboard Logging.txt", "[" & @MON & "/" & @MDAY & "/" & @YEAR & "][" & @HOUR & ":" & @MIN & ":" & @SEC & "] [Pasted] " & $GottenClipboard2)
    EndIf
    HotKeySet("3")
    Main()
EndFunc   ;==>HotKeyPaste3

Func HotKeyPaste4()
    GUISetState(@SW_HIDE)
    ClipPut($ClipperData[3])
    HotKeySet("^v")
    Send("^v")
    HotKeySet("^v", "ClipperActivatePaste")
    If $ClipboardLogging = "true" Then
        $GottenClipboard2 = ClipGet()
        FileWriteLine(@ScriptDir & "\Clipboard Logging.txt", "[" & @MON & "/" & @MDAY & "/" & @YEAR & "][" & @HOUR & ":" & @MIN & ":" & @SEC & "] [Pasted] " & $GottenClipboard2)
    EndIf
    HotKeySet("4")
    Main()
EndFunc   ;==>HotKeyPaste4

Func HotKeyPaste5()
    GUISetState(@SW_HIDE)
    ClipPut($ClipperData[4])
    HotKeySet("^v")
    Send("^v")
    HotKeySet("^v", "ClipperActivatePaste")
    If $ClipboardLogging = "true" Then
        $GottenClipboard2 = ClipGet()
        FileWriteLine(@ScriptDir & "\Clipboard Logging.txt", "[" & @MON & "/" & @MDAY & "/" & @YEAR & "][" & @HOUR & ":" & @MIN & ":" & @SEC & "] [Pasted] " & $GottenClipboard2)
    EndIf
    HotKeySet("4")
    Main()
EndFunc   ;==>HotKeyPaste5

Func tbOptions()
    GUISetState(@SW_DISABLE, $Form)
    $FormOptions = GUICreate($FormNameOptions, 251, 193, 192, 124)
    $_cStartWithWindows = GUICtrlCreateCheckbox("Start with Windows", 8, 8, 113, 17)
    $_cShowSystemTrayIcon = GUICtrlCreateCheckbox("Show System Tray icon", 8, 32, 137, 17)
    $_cLogClipboardEvents = GUICtrlCreateCheckbox("Log Clipboard events", 8, 56, 121, 17)
    $_cDeleteLogsAfter = GUICtrlCreateCheckbox("Delete logs after", 8, 80, 105, 17)
    $_iDeleteLogsAfter = GUICtrlCreateInput("0", 113, 80, 65, 21, BitOR($GUI_SS_DEFAULT_INPUT, $ES_NUMBER))
    $_lDays = GUICtrlCreateLabel("days.", 184, 80, 29, 17)
    $_bSupportDeveloper = GUICtrlCreateButton("Support Developer", 8, 152, 129, 33)
    GUICtrlSetFont(-1, 8, 800, 0, "MS Sans Serif")
    $_lTheme = GUICtrlCreateLabel("Theme", 8, 104, 37, 17)
    $_coTheme = GUICtrlCreateCombo("Clipper", 48, 104, 129, 25, BitOR($CBS_DROPDOWNLIST, $CBS_AUTOHSCROLL))
    $_bClose = GUICtrlCreateButton("Close", 144, 160, 97, 25)
    GUICtrlSetFont(-1, 9, 400, 0, "Segoe Print")
    GUICtrlSetState($_cShowSystemTrayIcon, 1)
    GUICtrlSetState($_cLogClipboardEvents, 1)
    GUISetState(@SW_SHOW)

    While 1
        $nMsg = GUIGetMsg()
        $_Reat_cStartWithWindows = GUICtrlRead($_cStartWithWindows)
        $_Reat_cShowSystemTrayIcon = GUICtrlRead($_cShowSystemTrayIcon)
        $_Reat_cLogClipboardEvents = GUICtrlRead($_cLogClipboardEvents)
        $_Reat_cDeleteLogsAfter = GUICtrlRead($_cDeleteLogsAfter)
        If $_Reat_cStartWithWindows = 1 Then
            If $LoopLock <> "true" Then
                MsgBox(64, $FormName, "Drag " & @ScriptName & " into the Startup folder to create the Startup entry.")
                Run("explorer.exe " & @HomeDrive & "\users\" & @UserName & "\AppData\Roaming\Microsoft\Windows\Start Menu\Programs\Startup\")
                Run("explorer.exe " & @ScriptDir)
            EndIf
            $LoopLock = "true"
        EndIf
        If $_Reat_cStartWithWindows = 4 Then
            If $LoopLock <> "false" Then
                MsgBox(64, $FormName, "Delete " & @ScriptName & " from the Startup folder to delete the Startup entry.")
                Run("explorer.exe " & @HomeDrive & "\users\" & @UserName & "\AppData\Roaming\Microsoft\Windows\Start Menu\Programs\Startup\")
            EndIf
            $LoopLock = "false"
        EndIf

        If $_Reat_cShowSystemTrayIcon = 1 Then
            TraySetState($TRAY_ICONSTATE_SHOW)
        EndIf
        If $_Reat_cShowSystemTrayIcon = 4 Then
            TraySetState($TRAY_ICONSTATE_HIDE)
        EndIf

        If $_Reat_cLogClipboardEvents = 1 Then
            $ClipboardLogging = "true"
            ControlEnable($FormNameOptions, "", $_iDeleteLogsAfter)
            ControlEnable($FormNameOptions, "", $_cDeleteLogsAfter)
        EndIf
        If $_Reat_cLogClipboardEvents = 4 Then
            $ClipboardLogging = "false"
            GUICtrlSetState($_cDeleteLogsAfter, 4)
            ControlDisable($FormNameOptions, "", $_iDeleteLogsAfter)
            ControlDisable($FormNameOptions, "", $_cDeleteLogsAfter)
        EndIf

        If $_Reat_cDeleteLogsAfter = 1 Then
            $ClipboardLoggingDeleteAfter = "true"
            $ClipboardLoggingDeleteAfterDays = GUICtrlRead($_iDeleteLogsAfter)
        EndIf
        If $_Reat_cLogClipboardEvents = 4 Then
            $ClipboardLoggingDeleteAfter = "false"
        EndIf
        Switch $nMsg
            Case $GUI_EVENT_CLOSE
                GUISetState(@SW_HIDE)
                GUISetState(@SW_ENABLE, $Form)
                Main()
            Case $_bSupportDeveloper
                MsgBox(64,$FormNameOptions,"Leave a like on the developer's (TheNewHunter/TheNewGuy) post to support him!")
                ShellExecute("www.autoitscript.com/forum/topic/173264-clipper-clipboard-manager/")
        EndSwitch
        Switch TrayGetMsg()
            Case $tbExit
                Exit
            Case $tbOptions
                tbOptions()
        EndSwitch
    WEnd

EndFunc   ;==>tbOptions

Conclusion

If you find any bugs or you have any ideas you are free to leave them here.

Please give this script a try because it took time. If you enjoyed this script PLEASE smash the like button, Thanks! :)

ALSO: Have any script ideas? Please share them with me because I will make them!

 

Clipper.au3

Edited by TheNewHunter
  • Like 1

Hello.

If in someway I have helped, please consider liking my post(s).

The formula for the right answer: You + Right Question = Answer

(Think) BEFORE you post.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

  • Similar Content

    • coffeeturtle
      By coffeeturtle
      Programs like Ditto are a great augmentation to the Windows clipboard where it keeps a list of items you copy and paste and you can go back to days, weeks, months later. It also comes in handy for multiple copied items you need to paste over and over again.
      https://sourceforge.net/projects/ditto-cp/
      Windows 10 also now has a clipboard history capability (though not as robust, I think, as Ditto).
      https://www.windowscentral.com/how-use-new-clipboard-windows-10-october-2018-update
      I would like to simulate this type of clipboard history into my own apps independent of Windows' clipboard, but I haven't a clue as to where to begin.
      Thank you in advance for any suggestions, examples, shelved codes. ☺
    • Valiante
      By Valiante
      I'm creating a tool which automatically saves screenshots.  I've found that some images appear corrupt after saving.  I've narrowed the source down to screenshots taken from within an RDP session via the Ctrl+Alt+Plus (PrtScn equivalent) and Ctrl+Alt+Minus (Alt+PrtScn equivalent) key combos.
      Here is the example code:
      #include <ClipBoard.au3> #include <GDIPlus.au3> If _ClipBoard_IsFormatAvailable($CF_BITMAP) Then ConsoleWrite("+Bitmap found on Clipboard" & @CRLF) If Not _ClipBoard_Open(0) Then MsgBox(16, "Error", "_ClipBoard_Open failed") Exit EndIf $hClipboardImage = _ClipBoard_GetDataEx($CF_BITMAP) _ClipBoard_Close() _GDIPlus_Startup() $hBitmap = _GDIPlus_BitmapCreateFromHBITMAP($hClipboardImage) $sCLSID = _GDIPlus_EncodersGetCLSID("JPG") _GDIPlus_ImageSaveToFileEx($hBitmap, @ScriptDir & "\" & TimerInit() & "_Clipboard_Image.jpg", $sCLSID, 0) _GDIPlus_BitmapDispose($hBitmap) _GDIPlus_Shutdown() Else MsgBox(48, @ScriptName, "No Bitmap found on Clipboard") EndIf If you copy a local window to the clipboard via Alt+PrtScn the above works fine.  If you copy a window in an RDP session via Ctrl+Alt+Minus it saves the image, but the left-hand edge appears to contain a few pixels sliced off the right-hand side of the bitmap (see two attached images for examples; one good, one bad).  If you paste directly into MSPaint, the image appears correctly, so the clipboard contents is good. It seems to be the process of converting the bitmap handle to an image file via GDIPlus which corrupts it (though I may be wrong about this).
      I've tried inspecting the contents of the clipboard via the _ClipBoard_EnumFormats example and I've noticed the clipboard from the RDP session contains a couple more formats;
      Local:
      Clipboard formats ..: 3 Clipboard format 1 .: Bitmap Clipboard format 2 .: DIB Clipboard format 3 .: DIB V5 RDP:
      Clipboard formats ..: 5 Clipboard format 1 .: DataObject Clipboard format 2 .: DIB Clipboard format 3 .: DIB V5 Clipboard format 4 .: Ole Private Data Clipboard format 5 .: Bitmap However the _ClipBoard_GetDataEx function is specifying the $CF_BITMAP constant for the format, which both instances contain, so I'm not sure the extra formats have any impact?
      I've tried using a combination of _ClipBoard_GetDataEx($CF_DIB) and _GDIPlus_BitmapCreateFromMemory in an effort to write the binary directly to a file, instead of using a bitmap handle, however this doesn't appear to work and just returns a zero and doesn't set @error to anything, which isn't covered in the help file (a failure should return a zero and set the @error level to something).
      I've hunted around the forums and tried everything I can think of. I can normally figure most things out without posting but I've been dipping in and out of this script for a few months now and have finally thrown in the towel and must ask you guys for help, which isn't a decision I take lightly.  Your help is, as always, greatly appreciated.


    • AndyS19
      By AndyS19
      I want to copy just the selected text in an input control and put it to the clipboard, but GuiCtrlRead() always reads all of the text in the control.
      In this test code, when I highlight a  portion of the left control's text and press ^C, I want to copy just that text to the clipboard; but when I highlight a  portion of the right control's text and press ^C, I want to copy all of its text to the clipboard.
      #include <Debug.au3> _DebugSetup(@ScriptName & "_debug.txt", False, 2, "") _DebugOut("=============== " & @MON & "/" & @MDAY & "/" & @YEAR & " " & @HOUR & ":" & @MIN & ":" & @SEC & " ====================") #include <GUIConstants.au3> #include <WinAPI.au3> #include <Array.au3> Opt("GUICloseOnESC", 1) ; ESC closes GUI? (0 = no, 1 = yes) Opt("GUIOnEventMode", 1) ; Set OnEvent mode Opt('MustDeclareVars', 1) OnAutoItExitRegister("Event_GUIClose") Opt("GUIEventOptions", 1) ;0=default, 1=just notification, 2=GuiCtrlRead tab index Opt("WinTitleMatchMode", -2) ;1=start, 2=subStr, 3=exact, 4=advanced, -1 to -4=Nocase Global $hWnd_MainWin, $iID_Left, $iID_Right _Main() Func _Main() $hWnd_MainWin = GUICreate("test7", 200, 300) $iID_Left = GUICtrlCreateInput("AAA BBB CCC (get Selected text)", 10, 30, 200, 25) GUICtrlSetOnEvent($iID_Left, "handle_left_btn") $iID_Right = GUICtrlCreateInput("DDD EEE FFF (get All text)", 10, 60, 200, 25) GUICtrlSetOnEvent($iID_Right, "handle_right_btn") Local $aAccelKeys[1][2] = [["^c", $hWnd_MainWin]] GUISetAccelerators($aAccelKeys) GUISetOnEvent($GUI_EVENT_CLOSE, 'Event_GUIClose') GUISetState() ; Make everything visible While 1 Sleep(127) WEnd EndFunc ;==>_Main Func handle_CTRL_C_key() ConsoleWrite("+++: handle_CTRL_C_key() entered" & @CRLF) Local $hCtrl, $ctrlID, $control_classname, $text $control_classname = ControlGetFocus($hWnd_MainWin) $hCtrl = ControlGetHandle($hWnd_MainWin, "", $control_classname) $ctrlID = _WinAPI_GetDlgCtrlID($hCtrl) If ($ctrlID = $iID_Left) Then $text = GUICtrlRead($ctrlID) ClipPut($text) ConsoleWrite("+++: Copied selected text:" & @CRLF & "==>" & $text & "<==" & @CRLF) ElseIf ($ctrlID = $iID_Right) Then $text = GUICtrlRead($ctrlID) ClipPut($text) ConsoleWrite("+++: Copied all text:" & @CRLF & "==>" & $text & "<==" & @CRLF) EndIf EndFunc ;==>handle_CTRL_C_key Func Event_GUIClose() Exit (99) EndFunc ;==>Event_GUIClose Func handle_left_btn() ConsoleWrite("+++: handle_left_btn() entered" & @CRLF) EndFunc ;==>handle_left_btn Func handle_right_btn() ConsoleWrite("+++: handle_right_btn() entered" & @CRLF) EndFunc ;==>handle_right_btn
       
    • fenhanxue
      By fenhanxue
      i want to copy a picture file to clipboard, so that i can paste the picture through ctrl+V
      this is my code ,but it dosen't work :
      #AutoIt3Wrapper_UseX64 = n #Include <Clipboard.au3> #include <GDIPlus.au3> _GDIPlus_Startup() $hClipboard_Bitmap = _GDIPlus_BitmapCreateFromFile('C:\1.jpg') _ClipBoard_Open(0) _ClipBoard_SetDataEx($hClipboard_Bitmap,$CF_BITMAP) _ClipBoard_Close() _GDIPlus_Shutdown() can you help me
    • leomoon
      By leomoon
      Hello,
      I'm trying to write a hotkey program and I know exactly how to do it but it will be hard coded and the user won't be able to edit it.
      HotKeySet("{ESC}", "HotKeyPressed") HotKeySet("^!d", "HotKeyPressed") HotKeySet("^+x", "HotKeyPressed") While 1 Sleep(500) WEnd Func HotKeyPressed() Switch @HotKeyPressed Case "{ESC}" Exit Case "^!d" ShellExecute("D:\Docs") Case "^+x" ShellExecute("D:\Docs\My Portables\Burner\AnyBurn\AnyBurn.exe") EndSwitch EndFunc I want the program to read a file that has hotkeys on odd lines and paths on even lines but I don't see how the program will load into itself.
      Is it even possible?
      Thanks.
×