simulating console input

Peter Münster pmlists@free.fr
Fri Sep 3 07:53:00 GMT 2010


On Thu, Sep 02 2010, Larry Hall (Cygwin) wrote:

> >How could I simulate the "Y" keypress?
> >
> >"echo Y | DosProgram.exe" does not work...
> >
> >The keypress is accepted only in a dos-console.
> 
> Read <http://cygwin.com/cygwin-ug-net/using-effectively.html#using-console>.
> Then add this fact - the SSH server uses ptys.  So your program will not
> work with a single character put in the input buffer.  One could
> envision using 'yes' to fill the buffer of the pipe that the Windows program
> interprets the pty to be.  Perhaps a nicer alternative is to build the
> problematic program with Cygwin, if that's an option, so that it will
> understand the pty.

Unfortunately, I don't have the source code of the program, so it's no option
to patch it.

I tested mintty: it does not work.

I understand, that there is nothing to do with a pipe to the pty or stdin.

I'm thinking of something like this:

ConsoleKeypressSimulator.exe --delay 10 --key y &
DosProgram.exe

And for proper operation, the DosProgram needs a "y" keypress about 10 seconds
after begin of execution.

So my questions are:
- Is it possible to write such a program: ConsoleKeypressSimulator.exe ?
- If yes, what is the degree of difficulty to write that?

Thanks for your help!
Peter

-- 
Contact information: http://pmrb.free.fr/contact/



--
Problem reports:       http://cygwin.com/problems.html
FAQ:                   http://cygwin.com/faq/
Documentation:         http://cygwin.com/docs.html
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple



More information about the Cygwin mailing list