2

I want a program that automatically clears my clipboard 10 minutes after I copy something. I don't want it to clear my clipboard every 10 minutes, as there is plenty of programs out there to do that, and I could lose some data if I copy something and it happens to be at the end of the 10 minutes and it gets erased.

Needs:

  • start clear clipboard timer when I copy

  • timer to be changable

  • lightweight

  • run in background (no window)

  • no pop up notifications or anything

  • run on Windows, no other OS's needed

  • works with right-click copy, Ctrl-C, and Ctrl-X

The point of this is to not leave passwords and other text on the clipboard, but not get in the way of work. I'll never need to have anything on there for longer then 10 minutes, so why not flush the buffer.

If there is something similar written in Java that's also open source, maybe I could learn something from it and write my own program.

I could use AHK, but I don't know enough about it to write something like this. Help on that would also be good.

2
  • For passwords, why not use a password manager instead? Those do clear the clipboard or maybe don't even use it at all, in addition to automatically generate good passwords and securely storing them.
    – Alejandro
    Apr 10, 2018 at 22:28
  • Open source password manager - KeePass clears clipboard automatically. No sure about embarrassing text :)
    – Maris B.
    Apr 11, 2018 at 12:47

1 Answer 1

0

This should work with AHK:

#Persistent
OnClipboardChange("ClipChanged")
return

ClipChanged(Type) {
    SetTimer, clearCB, 600000
}

clearCB:
clipboard =
return

The 600000 is the time in milliseconds after which the clipboard is cleared after it's last update.


EDIT:

The above only clears the clipboard if it is updated after the script is launched. If you want the clipboard to be cleard 10 minutes after launching the script (assuming it isn't updated during that time), use this:

#Persistent
return

OnClipboardChange:
SetTimer, clearCB, 600000
return

clearCB:
clipboard =
return
2
  • And if I wanted to actually set the clipboard to something, I would use clipboard = "some_text", right? Apr 15, 2018 at 14:14
  • Yes, but without quotation marks i.e. clipboard = some_text. The documentation is also very helpful.
    – jullit31
    Apr 15, 2018 at 19:07

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.