Clipboard history. Topic is solved

Get help with using AutoHotkey (v2 or newer) and its commands and hotkeys
Marco Gatti
Posts: 20
Joined: 11 Dec 2023, 15:10

Clipboard history.

Post by Marco Gatti » 11 Dec 2023, 15:48

First of all I would like to greet all the users of this forum.

I would like to kindly ask for help in order to delete the entire history of the clipboard without having to do it manually every time.

Before writing this request I tried to look for the solution in the previous post but I couldn't find anything.

I thank in advance anyone who can help me.

Regards.
Marco Gatti

User avatar
MrDodel
Posts: 96
Joined: 28 Apr 2021, 09:03
Location: Event Horizon

Re: Clipboard history.

Post by MrDodel » 11 Dec 2023, 16:14

Marco Gatti wrote:
11 Dec 2023, 15:48
First of all I would like to greet all the users of this forum.

I would like to kindly ask for help in order to delete the entire history of the clipboard without having to do it manually every time.

Before writing this request I tried to look for the solution in the previous post but I couldn't find anything.

I thank in advance anyone who can help me.

Regards.
Marco Gatti
Check https://www.autohotkey.com/docs/v2/lib/A_Clipboard.htm
Last edited by MrDodel on 11 Dec 2023, 16:15, edited 1 time in total.
So much universe, and so little time. GNU Sir Terry.

emp00
Posts: 160
Joined: 15 Apr 2023, 12:02

Re: Clipboard history.

Post by emp00 » 11 Dec 2023, 16:15

Try this -- Source -> here

Code: Select all

RunWait(A_ComSpec " /c echo | clip")

teadrinker
Posts: 4389
Joined: 29 Mar 2015, 09:41
Contact:

Re: Clipboard history.  Topic is solved

Post by teadrinker » 11 Dec 2023, 16:52

Code: Select all

#Requires AutoHotkey v2.0

if !ClearClipboardHistory() {
    MsgBox 'Failed to clear clipboard history'
}

ClearClipboardHistory() {
    static IID_IClipboardStatics2 := '{D2AC1B6A-D29F-554B-B303-F0452345FE02}'
         , wrtClass := 'Windows.ApplicationModel.DataTransfer.Clipboard'

    DllCall('Combase\WindowsCreateString', 'Str', wrtClass, 'UInt', StrLen(wrtClass), 'PtrP', &HSTRING := 0)
    DllCall('Ole32\IIDFromString', 'Str', IID_IClipboardStatics2, 'Ptr', riid := Buffer(16))
    DllCall('Combase\RoGetActivationFactory', 'Ptr', HSTRING, 'Ptr', riid, 'PtrP', IClipboardStatics2 := ComValue(VT_UNKNOWN := 13, 0))
    DllCall('Combase\WindowsDeleteString', 'Ptr', HSTRING)
    ComCall(ClearHistory := 7, IClipboardStatics2, 'UIntP', &res := 0)
    return res
}

Marco Gatti
Posts: 20
Joined: 11 Dec 2023, 15:10

Re: Clipboard history.

Post by Marco Gatti » 12 Dec 2023, 02:17

First of all I wish everyone a good day.

With this message I would like to thank you for the quick replies that helped me resolve the problem.

Regards.
Marco Gatti

teadrinker
Posts: 4389
Joined: 29 Mar 2015, 09:41
Contact:

Re: Clipboard history.

Post by teadrinker » 12 Dec 2023, 04:18

Have a good day, too! :)

User avatar
xMaxrayx
Posts: 220
Joined: 06 Dec 2022, 02:56
Contact:

Re: Clipboard history.

Post by xMaxrayx » 12 Dec 2023, 05:36

anyone know to remove the last one only?
-----------------------ヾ(•ω•`)o------------------------------
https://github.com/xmaxrayx/


Post Reply

Return to “Ask for Help (v2)”