I want to copy some rich text, modify its source code (changing some tags and text, using regex and/or beautifulsoup) and send it back to the clipboard. I'm looking for the easiest way to do that.
I tried win32clipboard, but it doesn't support the CF_HTML
format (windows clipboard contains many formats).
So I'm looking for a module that could help me to get this format: if the CF_HTML clipboard format contains HTML, store it in that variable, do some operation, then send it back. (Optionally: and do other stuff on other clipboard formats)
Here is a Linux equivalent of what I'm looking for. It retrieves the HTML source, when there's some in the clipboard (source)
#!/usr/bin/env python
import gtk
print (gtk.Clipboard().wait_for_contents('text/html')).data
Edit1: There is a work around with pywin32 using this script. But is there a module able to do that directly (if CF_HTML contains data, get it, and send it back)?