win32clipboard operation

MRAB python at mrabarnett.plus.com
Thu Jul 23 12:05:09 EDT 2009


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()




More information about the Python-list mailing list