Link to home
Start Free TrialLog in
Avatar of Benjamin297
Benjamin297

asked on

Automate Program Execution is DOS

Hello,

I have a third party tool which I need to be able to control via a batch file using DOS. The third party tool has a very basic yet repetative setup operation associated with it, which is time consuming and must be repeated many times, therefore I want to automate the commands I enter into the third party tool.

For example, I need to open the third party tool - 'mss.exe'. And then want to automate the task of entering a list of commands sequentially one after the other - it will be necessary to simulate a key stroke <enter> after each unique command.

Im offering 250 points for this problem, which should be quite easy to resolve. If a solution is offered very very quickly I will raise the points. Im under a strict deadline on this one.

Im working on a secure environment and must use batch file processing to perform this task - or any other solution which can be acheived using the core windows setup.

Any help with this would be grately appreciated.

 
Avatar of Steve Knight
Steve Knight
Flag of United Kingdom of Great Britain and Northern Ireland image

Try entering your commands one by one into a text file with edit or notepad and save as input.txt then you can do

mss.exe < input.txt

Make sure input.txt is a complete command list including exit commands or whatever at th end as the text file will completely replace keyboard input

Every time you put a Return in your input file it ill be input to the program too btw.  If you need to press any funny characters or buttons (is this a text mode program, text 'graphical' program with buuttons and menus or a windows program btw?

hth

Steve
Avatar of Benjamin297
Benjamin297

ASKER

Hi dragon-it,

I tried to create the file but I got an error when I ran the program. The console window immediatly closed, so I retried by calling the batch file from dos, where I got the error

C:\Test>mss.exe0<test.txt
The System Cannot Find the File Specified.

Im not sure where the '0' is coming from in the error text, it is not coming from my batch file?

Any other ideas?
Ok I resolved that problem, but it doesnt seem as if the commands are being run as expected. I have a text file containing commands of the format...


D ^API
D ^BIJ
D ^SSD

The first line of which needs to be blank - symbolising the enter key being pressed. The console opens and is waiting for input but it does not progress any further.

?
Don't worry about the 0.  Ghat is normal it is the code for stdin.

What it is saying is it can't find test.txt in the current directory.  Check that is what the file is called and where it is- for ease save it in the same dir as mss.exe or add the path too, I.e.

mss.exe<c:\test.txt
Is this a proper DOS program or a more modern Windows console based one?  If it won't take redirected standard input then you have got to look at solutions like AutoIT to script pressing keypresses into the Window, that doesn't fit with your request of native only tools though.

Steve
This program is basically a programming interface called 'Mumps' it is a prehistoric language and is not DOS based, although the interface is very similar.
Would AutoIT executables be runnable without installing any third party software onto a machine?
Sorry have been out all day.  Autoit itself needs to install but you could install that elsewhere;write your script and compile it into an exe then it is a standlone exe that doesn't need anything in particular installed.

With that you could run the mss, wait for a windows with the right title to appear then send the keys requied.  You can do stuff like {enter} and function keys etc. of course.

On mobile at the moment, will look back later and ask if you want some help with the autoit scripts.
ASKER CERTIFIED SOLUTION
Avatar of For-Soft
For-Soft
Flag of Poland image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
AutoIT solved the problem well, everythings working as expected. Now I have to persuade the boss to put an exe on the secure system. Thanks for your help
Er thanks .... any particualr reason for a) the grade of answer and b) the choice of answer?  I suggested a number of things including auto-it and worked with you on this one before For-soft gave a comment at the end?

Steve
Yes sorry dragon-it, this was a mistake on my part, the points were intended for you. I will try and get this changed through a moderator? Sorry again
As far as the grade of the answer goes, I gave it a B because it did not stick to the requirement of not using third party tools.
I will post a question to get it reopened for you to reselect your answer.

As to the grade.

An answer was given that works perfectly with dos applications with no additional tools but your program turned out to be a windows application not dos.

There are no built in tools I am aware of aside from POSSIBLY vbs using Sendkeys that can do what you want so reducing grade because of an impossible question that changed from dos to windows issue is a little unfair.

thanks

Steve