My java program executes an old DOS program for file conversion, which
is called by something like Runtime().getRuntime().exe("convert infile
outfile").
However, the 'convert' program asks its user to 'Press any key to
continue..." My first guess was to just write any character to the
process' InputStream, but this doesn't work; this is not specific for
java, as something like "convert infile outfile < anyKeyFile" doesn't
work from a DOS box either. Any clue how to simulate the pressing of any
key here?

Signature
Grinnikend door het leven...
Remi Arntzen - 30 Jun 2005 05:26 GMT
quote from class Process documentation (1.5 doc)
"The methods that create processes may not work well for special
processes on certain native platforms, such as native windowing
processes, daemon processes, Win16/DOS processes on Microsoft Windows,
or shell scripts."
A good example is a windows '.bat' file with only "pause" as a command.
The InputStream only shows the "pause" command echoed by the process,
but not the "Press any Key" statement.
If the "press any key" thing is at the end of the program it might just
be best to ignore it and call Process.destroy(). If pressing a key is
truly necessary "to continue..." then that won't be any help.
Good luck.
Remi Arntzen
Remi Arntzen - 30 Jun 2005 05:35 GMT
I thought I was on to something...
java.awt.Robot r = new java.awt.Robot();
r.keyPress(71);
Thread.sleep(1000);
r.keyRelease(71);
But it doesn't work, because there is no console displayed on screen.
Bent C Dalager - 30 Jun 2005 10:13 GMT
>However, the 'convert' program asks its user to 'Press any key to
>continue..." My first guess was to just write any character to the
>process' InputStream, but this doesn't work
Did you flush the stream?
Cheers
Bent D

Signature
Bent Dalager - bcd@pvv.org - http://www.pvv.org/~bcd
powered by emacs
Izak van Langevelde - 30 Jun 2005 20:38 GMT
> >However, the 'convert' program asks its user to 'Press any key to
> >continue..." My first guess was to just write any character to the
> >process' InputStream, but this doesn't work
>
> Did you flush the stream?
The problem is the convert program wants a keystroke instead of input...

Signature
Grinnikend door het leven...