win32clipboard operation

LeeRisq leerisq at gmail.com
Thu Jul 23 13:07:05 EDT 2009


On Jul 23, 9:05 am, MRAB <pyt... at mrabarnett.plus.com> wrote:
> LeeRisq wrote:
> > Hi all,
>
> > Newbie question. I've written a script that outputs to a text file.
>
> > Now, I just want to copy the content to win32clipboard for access to
> > other applications. Here's the mess I've come up with so far:)
>
> [snip]
>
> def copy_text():
>      ifile = open(r"C:\Query\DQL.txt", "r")
>      text = ifile.read()
>      ifile.close()
>
>      win32clipboard.OpenClipboard()
>      win32clipboard.EmptyClipboard()
>      win32clipboard.SetClipboardText(text)
>      win32clipboard.CloseClipboard()

I've actually tried this configuration, but I did it again just to be
sure. The program executes without exception, but the text still isn't
copied to the clipboard. Any ideas?



More information about the Python-list mailing list