win32clipboard operation
MRAB
python at mrabarnett.plus.com
Thu Jul 23 13:42:21 EDT 2009
LeeRisq wrote:
> 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?
All I can say is that it works for me (Windows XP Pro, service pack 3).
More information about the Python-list
mailing list