Link to home
Start Free TrialLog in
Avatar of StorErikMarklund
StorErikMarklund

asked on

W2k script. command based program needs menu input.

Hi,

I have a program that checks some application things which can be run manually from
a command prompt.
What i want to do is to script it in a batch file ( w2k ) but the program
needs to have input to get to the correct screen inside the program.

Example if run it manually........
c:\> test.exe   ( after i press enter i get to a menu )
The next steps in the program would be choosing menu item " m "
which shows another screen with info that i want want to pipe to a log file. So i would like it
to look something like this

c:\>test > test.log
m
q

It would automatically run the program, enter the menu selection " m ", show info on that screen and then choose " q " for quit.

So how can i enter the inputs that is needed in the script automatically ? The program
is just a ascii menu driven program, dos program. No graphics so the info that comes on the screen should be fine in a log file.

Anyone ?
Avatar of YarnoSG
YarnoSG
Flag of United States of America image

your arrow needs to be pointing the other direction:

TEST < Test.log
Look up redirection in the Windows Help Index.
Avatar of oBdA
oBdA

If you don't need to hit <return> after typing "m" or "q", try the following command:
echo mq|test.exe
If this doesn't work, create an additional file named, for example, test.txt, with this content:
m
q
Then run the following command:
test.exe <test.txt

If this works, simply add the >YourLogfile at the end of the line.
Avatar of StorErikMarklund

ASKER

Hi,

Sorry but that doesnt work. It requieres enter after each menu selection.
It looks like doing as oBdA suggested then program starts and stops
after the first menu is shown, if i then hit enter it goes on in an endless loop until i do cntrl c

So i need the program to start, gets to the first menu, i then need to make a selection and hit enter and it will get me to a new menu that shows info
and then quit.

Anyone ?
Hi StorErikMarklund,
What other options does this program have? Does it have options to output anything to a file? Can it accept command line parameters? Also, after you hit m,enter, the text it outputs, does it fit on a single screen, does it scroll, does the ammount of info vary? I've got a solution for running through the selections you need I'm just still working on a way to gather the info output to the screen.
ASKER CERTIFIED SOLUTION
Avatar of Bernie Salvaggio
Bernie Salvaggio
Flag of United States of America 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
There's also a utility in the program folder for AutoHotKey (after you install it of course) that will let you convert the .ahk script into a .exe that'll run on a computer that doesn't have AutoHotKey installed.
Also, depending on how fast your program does what it needs to do, you may need to increase the values for 'sleep'.  Try them at increments of 50.
The answer I posted with Autohotkey works but probably wasn't as refined for what the asker was exactly looking for, though he never resopnded with more info for resolving the question...