[Tutor] Program to Simulate Keystrokes

Alan Gauld alan.gauld at btinternet.com
Tue Aug 4 19:55:52 CEST 2009


"Megan Land" <mland at us.ibm.com> wrote


> I'm working on a python script to automate a program we run at work.  The
> program is run from one command.  The only problem is that it asks you to
> hit enter to continue after it runs.  Is there a way I can do this?

Assuming it is using stdin/out to read the keystrokes you shjould be able
to use the subprocess module to communicate with the process.
Read stdout, detect the message and send a newline character
to the process.

> If at all possible I need a program that will work on Windows and Linux 
> (I
> know a tall order).  I'm trying to keep this simple but if I have to use
> two different programs I will.

stdin/out should work on both.

If its a GUI program then things get much more complicated!

-- 
Alan Gauld
Author of the Learn to Program web site
http://www.alan-g.me.uk/ 




More information about the Tutor mailing list