0

I'd like to delete the latest entry from the clipboard history, is that doable using AutoHotkey?

enter image description here

To be specific, suppose I have run Clipboard := "foo", I want to remove the "foo" entry from the clipboard history.

Wenfang Du
  • 8,804
  • 9
  • 59
  • 90
  • [Clipboard](https://www.autohotkey.com/docs/misc/Clipboard.htm) is a built-in [variable](https://www.autohotkey.com/docs/Variables.htm#Intro). You can erase the contents of that variable (make it blank) by setting it to "" : `Clipboard := ""`. – user3419297 Nov 19 '21 at 10:40
  • @user3419297 Yes, but that doesn't remove the previously assigned value ("foo" in this case) from the clipboard history though. Is there any way to do that? – Wenfang Du Nov 19 '21 at 11:59
  • 1
    After Win+V press Del to delete the latest entry. – user3419297 Nov 19 '21 at 17:44
  • 1
    Sounds like a fun challenge, unfortunately I don't have time to solve it for you right now. I can in a few days. If you're up for trying it, the answer is in [this](https://learn.microsoft.com/en-us/uwp/api/Windows.ApplicationModel.DataTransfer.Clipboard?view=winrt-22000) documentation page. I must say, it is very advanced. [This](https://stackoverflow.com/questions/61047858/how-to-check-if-sound-device-connected-in-autohotkey-script/61052055#61052055) previous answer of mine might give some insight. But that answer is not for UWP, so a few things need to be done a different way. – 0x464e Nov 19 '21 at 18:20
  • 1
    Actually, a Google search gave me [this](https://www.autohotkey.com/boards/viewtopic.php?t=86227&p=378706#p378793). Someone has already done most of the work for you and wrapped it to a nice OOP implementation. You'd only need to add [DeleteItemFromHistory()](https://learn.microsoft.com/en-us/uwp/api/windows.applicationmodel.datatransfer.clipboard.deleteitemfromhistory) method to that. – 0x464e Nov 19 '21 at 18:25

0 Answers0