automate commands to an .exe console program through python

Chris Angelico rosuav at gmail.com
Tue Dec 13 06:24:59 EST 2011


On Tue, Dec 13, 2011 at 10:21 PM, Juan Perez <corleone82 at gmail.com> wrote:
> Well, if developers have to change something to the code, I'd continue with
> autoit, since is closer to real enviroment. You are right, autoit work by
> send parametres to GUI focused, but really I don't think it's something
> necessary for my purposes as I need only send parameters to a windows cmd
> console. Do you know if is that possible by piping standard input? I've
> tried but with no results. What I'd need is open a new windows console get
> the pid and send messages to it through stdin pipe. But I've been unable to
> do it so far.

The easiest way to see whether a pipe will work or not is to put the
commands into a file and use redirection:

NameOfProgram <scriptfile

If that works, you can drive it with a pipe. If not... you'd have to
figure out exactly _how_ it gets its input. Assuming you don't have
access to the source code for that program, you'll need to tinker and
experiment until you find what works. Good luck, have fun. You may
have a quite tedious job ahead of you.

ChrisA



More information about the Python-list mailing list