By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
429,435 Members | 1,967 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 429,435 IT Pros & Developers. It's quick & easy.

Send a text

P: 3

I'm trying to send some text in wordpad and here is my script:
Expand|Select|Wrap|Line Numbers
  1. import win32gui
  2. import win32api
  3. import win32con
  4. import time
  5. Notepad= win32gui.FindWindow(None,"Sans titre - Bloc-notes")
  6. win32gui.SetForegroundWindow(Notepad)
  7. editbox = win32gui.FindWindowEx(win32gui.GetDesktopWindow(),None,"Notepad",None)
  8. time.sleep(3)
  9. win32api.PostMessage(editbox,win32con.WM_KEYDOWN,ord("x"),0) 
There is no error but it doesn't work. The letter "x" is not written in wordpad. Could you explain to me how to do it? Thanks for your help.
Nov 4 '09 #1
Share this question for a faster answer!
Share on Google+

Post your reply

Sign in to post your reply or Sign up for a free account.