0

Hello,

I have a weird problem... When I use the clipboard, code runs without error.

Attempt to paste directly after run in any application does not work.
Pasting in the python shell works fine.
After pasting in the python shell, pasting in any other application works fine !!!

Need help fast...

Thanks...

(working with python 2.5 on Vista...)


code (justed picked of the web)
import win32clipboard

def txtToClipboard(iTxt):
win32clipboard.OpenClipboard(0)
win32clipboard.EmptyClipboard()
win32clipboard.SetClipboardText(iTxt)
win32clipboard.CloseClipboard

txtToClipboard('blahblah')

2
Contributors
1
Reply
2
Views
9 Years
Discussion Span
Last Post by Ene Uran
0

Works great with an XP, so it could be Vista that srews things up.

# send text to the clipboard

import win32clipboard

def txtToClipboard(iTxt):
    win32clipboard.OpenClipboard(0)
    win32clipboard.EmptyClipboard()
    win32clipboard.SetClipboardText(iTxt)
    win32clipboard.CloseClipboard

txtToClipboard('text to paste')

# test
# or use paste in the editor window
data = win32clipboard.GetClipboardData()
print data
This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.