Sending keystrokes to Windows exe programs

Alex van der Spek zdoor at xs4all.nl
Sat Apr 2 18:48:44 CEST 2011


I can start a windows program on Vista with:

>>> import subprocess
>>> dva=subprocess.Popen(DVAname,stdin=subprocess.PIPE)

Unfortunately sending keystrokes with communicate() does not appear to work:

>>> dva.communicate('F2')

this does not produce any result but it does make IDLE become really idle.

 >>> dva.terminate()

however does work fine and kills the program as it should.

Is there a way or do I have to go back to Visual Basic?

Regards,
Alex van der Spek 




More information about the Python-list mailing list