Send a text

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • MegaOctet
    New Member
    • Oct 2009
    • 3

    Send a text

    Hello,

    I'm trying to send some text in wordpad and here is my script:
    Code:
    import win32gui
    import win32api
    import win32con
    import time
    Notepad= win32gui.FindWindow(None,"Sans titre - Bloc-notes")
    win32gui.SetForegroundWindow(Notepad)
    editbox = win32gui.FindWindowEx(win32gui.GetDesktopWindow(),None,"Notepad",None)
    time.sleep(3)
    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.
Working...