473,395 Members | 1,730 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

Managing multiple input in a .exe file

Hello guys,

I'm trying to open a .exe file and insert multiple inputs.
the problem is that when I open the file it requests each input at a time, like thin

(starting program in the prompt mode of windows)

insert input 01: ##(here I should insert an input and ##press enter if I were using the program in the prompt ##mode)

insert input 02: ##(here I should insert the second ##input and press enter if I were using the program in ##the prompt mode)

the first input is a file that has all data that the program need to calculate;
the second file has the outputs of the file.

Is there anyway that I could manage this file using python?
Dec 10 '11 #1
6 2726
Glenton
391 Expert 256MB
This depends a little bit on whether the .exe has some ability to handle the inputs differently.

Eg, can you run the exe by typing at the prompt:
Expand|Select|Wrap|Line Numbers
  1. >>prog.exe input output
or similar. If so, then you can easily do it with python.

If in insists on a manual input then you may need something else. If you're using linux X11 could do the job.
Dec 13 '11 #2
Unfortunately I can't do that. The program calls each input at a time.
like, using the program at the cmd prompt of windows:

(starting the program in prompt of windows)
give the input file: (then we type the input file and press enter)
give the output file: (we type the output file and press enter)

've already tried to do so using the

os.system('program < input n/ output')

but this didn't work very well. I've tried also the "commands" and nothing also worked. I've even tried the subprocess.Popen, but I didn't find the way to do this working.

I hope you can help-me

Thanks a lot,
Álvaro
Dec 13 '11 #3
Glenton
391 Expert 256MB
Where did this exe file come from? It may be easier to fix it!

However, X11 is a great programme and easy to use to simulate mouse and key board input. You can, therefore, set it up to simulate entering the data. People have used it, as a funny example, to click all their fields in farmville automatically! However, this is a linux thing, so may not suit you. I'm not sure if there is a PC equivalent/version.

The trouble is that if python runs the .exe through it's command then it essentially loses control (with the .exe taking over) while waiting for user input.

I'd be interested to hear how you get on.

Are you really sure that you can't enter the files on the first command line - this is the standard way around this problem. Can you check the documentation of the exe file.
Dec 14 '11 #4
Hello!

This program is a vortex lates method used to provide some aerodynamic characteristics of a wing that we define in the input file of the program.
It has been developed by Professor Vasco Brederode (a Portuguese aerodynamicist) and given to us by our professor Soviero to develop a study over a combination of wings.
The way to solve the exercise we managed, but I'm really interested to know how could I do this thing. It's a really important thing to us as engineers.
Is there any way that I could send you the files and you see how does the program looks like?

Thanks a lot,
Álvaro
Dec 14 '11 #5
Glenton
391 Expert 256MB
Hi Alvaro

It is better to keep the discussion public. You're welcome to post your code though.

Regarding the vortex lattice program, do you have the source code? Or can you get it. Depends on the language that it's in, but it should be a very trivial edit to make it work with inputs on the command line. It's probably Fortran or C++.

There's a book called Python Scripting for Computational Science which I'd recommend for this kind of thing. It has a section on running Fortran scripts from python (which is an ideal mix in many ways because the Fortran or C++ or whatever does the heavy lifting and the python does the file handling, graphing etc).

I'll put this question to some of the other experts, but I really think editing the original .exe (or finding out how to use it) is the way to go.
Dec 15 '11 #6
YarrOfDoom
1,247 Expert 1GB
os.system('program < input n/ output')
This wouldn't work because the "<" operator on the commandline is made for input from files, not strings.

You could try writing input and output to a file and then use that file to run the program with.
Something like this:
Expand|Select|Wrap|Line Numbers
  1. f = open('temp', 'w')
  2. f.write('input\n')
  3. f.write('output\n')
  4. f.close()
  5. os.system('program < temp')
Dec 15 '11 #7

Sign in to post your reply or Sign up for a free account.

Similar topics

1
by: Elizabeth Gary | last post by:
How can I enter in multiple input lines to an array? Example: Enter your mailing address: 7660 Eyespy Court Clinton, Mississippi 32322 When I try to do this perl just sits and waits for...
0
by: Eliezer Figueroa | last post by:
Managing Multiple Excel incoming files? I have this situation. I have a client which have several locations they work primary with excel forms and they are thinking in doing reports with them....
1
by: Cliff Williams | last post by:
How are people managing multiple, interdependent projects in the same solution? If I have to rebuild my solution file one more time, I think my head is going to spin around and pop off. I've...
9
by: paczkow | last post by:
Dear Python Community, I am an engineering and I am experiencing some trouble. Having output data from other software I want to use it. To achieve this I decided to use Python since this...
5
by: jwright | last post by:
I have decided to use a struct to collect my data. The input file is comma dilineated between almost all of the fields. Here is the code I have so far and a sample input and output file. ...
0
by: srikar | last post by:
Hi all, I am having a problem, when I am compiling the code in 32 bit option on a 64 bit machine using the macro CPPFLAGS= -m32 I am getting the following warnings from the linker . ...
2
by: max.giacometti | last post by:
Hi everybody! I am using lex and yacc to write a vhdl to systemc converter. Lex simply reads the input file and yacc implements grammar and translation. I'd like to be able to make yacc...
5
by: ezechiel | last post by:
hi everyone.. i read on another forum that it is possible to define multiple input masks for a textbox (for example). There is a textbox field where you can enter the name of a machine. The...
1
by: Lucky Beniwal | last post by:
I need to write a function parse_in with the following prototype : int parse_in(FILE *f, int *cost){ /* parse the input file and fill in const array * Need to return the number of cities read...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.