Can this be done in py?

R

Robert Singer

Now, don't get me wrong if this is a trivial question, or even an
apsurd one. I'm new to python, so my mileage may vary.

I have several exe files, console applications that pretty much run on
the principle:
<starting> first.exe
Enter file name: start.dat
<outputs filename.dat> <end of first.exe>

<starting> second.exe
Enter file name: filename.dat
<output result.dat> <end of second.exe>

.... you get the point.

These are old exe programs, not mine (I can't recompile them or modify
them in any way), but which work fine and I still regularly use them.
However, I would like to automate this process (since they are not
just two, and since this process of entering always the same data is
tiresome.

Is there a way this could be done with a python script ?
A script which starts the .exe file, enters some predefined data,
waits for an exe to finish, then again, starts the second .exe file,
.... ?

I would appreaciate any input you can give on this problem.
 
M

Mathieu Prevot

2008/11/7 Robert Singer said:
Now, don't get me wrong if this is a trivial question, or even an
apsurd one. I'm new to python, so my mileage may vary.

I have several exe files, console applications that pretty much run on
the principle:
<starting> first.exe
Enter file name: start.dat
<outputs filename.dat> <end of first.exe>

<starting> second.exe
Enter file name: filename.dat
<output result.dat> <end of second.exe>

... you get the point.

These are old exe programs, not mine (I can't recompile them or modify
them in any way), but which work fine and I still regularly use them.
However, I would like to automate this process (since they are not
just two, and since this process of entering always the same data is
tiresome.

Is there a way this could be done with a python script ?
A script which starts the .exe file, enters some predefined data,
waits for an exe to finish, then again, starts the second .exe file,
... ?

Of course. See the subprocess module for this.

Mathieu
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,997
Messages
2,570,240
Members
46,828
Latest member
LauraCastr

Latest Threads

Top