win32clipboard problem

Reply

Join Date: Jun 2008
Posts: 3
Reputation: ldk is an unknown quantity at this point 
Solved Threads: 0
ldk ldk is offline Offline
Newbie Poster

win32clipboard problem

 
0
  #1
Oct 10th, 2008
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')
Reply With Quote Quick reply to this message  
Join Date: Aug 2005
Posts: 1,514
Reputation: Ene Uran has a spectacular aura about Ene Uran has a spectacular aura about 
Solved Threads: 168
Ene Uran's Avatar
Ene Uran Ene Uran is offline Offline
Posting Virtuoso

Re: win32clipboard problem

 
0
  #2
Oct 10th, 2008
Works great with an XP, so it could be Vista that srews things up.
  1. # send text to the clipboard
  2.  
  3. import win32clipboard
  4.  
  5. def txtToClipboard(iTxt):
  6. win32clipboard.OpenClipboard(0)
  7. win32clipboard.EmptyClipboard()
  8. win32clipboard.SetClipboardText(iTxt)
  9. win32clipboard.CloseClipboard
  10.  
  11. txtToClipboard('text to paste')
  12.  
  13. # test
  14. # or use paste in the editor window
  15. data = win32clipboard.GetClipboardData()
  16. print data
drink her pretty
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:



Other Threads in the Python Forum
Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC