save windows clipboard content temporarily and restore later

kakarukeys kakarukeys at
Thu Oct 8 17:27:23 CEST 2009

Is there a way to:

1. save windows clipboard content temporarily in a variable
2. (the clipboard content is then overwritten by some other
3. restore the saved data back into the clipboard.


I've tried win32clipboard's GetClipboardData, SetClipboardData.
The GetClipboardData method is able to retrieve clipboard content only
after a format is specified.
Restoring the data with that format could result in information loss,
for example when HTML text is saved in ordinary text format. There is
no format that could preserve 100% of any kind of clipboard content.

Does anyone has a brilliant solution?

More information about the Python-list mailing list