Re: Can python access windows clipboard



En Thu, 21 Jun 2007 05:59:06 -0300, MaHL <mhl1983@xxxxxxxxx> escribió:

Can I use python to copy something(like a string) to the clipboard, so
that I can paste it somewhere else. Is there a way to do this?

Yes, using the pywin32 extensions that you can download from Sourceforge

py> from win32clipboard import *
py> OpenClipboard()
py> EmptyClipboard()
py> SetClipboardText("Hello from Python!")
11272196
py> CloseClipboard()

Ctrl-v: Hello from Python!

--
Gabriel Genellina

.



Relevant Pages

  • Screenshot with cursor?
    ... ::OpenClipboard ... ::EmptyClipboard ... ::SetClipboardData ...
    (microsoft.public.vc.mfc)
  • Re: I Just Want to Copy Text to the Clipboard
    ... > In the following code (GetLastError calls added for debugging): ... > OpenClipboard returns TRUE. ... EmptyClipboard returns FALSE. ...
    (microsoft.public.win32.programmer.kernel)