Python + Win32: Cut/Paste w/o GUI

Tim Daneliuk tundra at
Sat Oct 5 21:50:08 CEST 2002

Roger Upole wrote:
> You can grab the clipboard text using the win32clipboard module.
> import win32clipboard
> win32clipboard.OpenClipboard()
> print win32clipboard.GetClipboardData()
> win32clipboard.CloseClipboard()
> It won't really be copy'n'paste, but all you would have to do is copy the
> text you need and double-click the script, which can then do whatever it
> wants with the text.  If you really wanted it to look like a Paste, you
> could
> add a Paste action the the .py filetype.
>           Roger

*Exactly* the magic that I was looking for.  Many thanks... (and also to the
other folks who took the time to respond...)
Tim Daneliuk
tundra at

More information about the Python-list mailing list