writing a script to simulate keyboard input

Hello,

I have to use an archaic, menu-driven C program that requires keyboard
input to process commands (all of these commands are terminated by a
newline)

I was wondering if there was any way I could use the program within a
script so that I could have the script "feed" in the sequence of
keystrokes/string-inputs that I must otherwise type in manually?

As ever, all help/advice is appreciated.


Thanks,

-K

-
To unsubscribe from this list: send the line "unsubscribe linux-newbie" in
the body of a message to majordomo [at] vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.linux-learn.org/faqs
Karthik Vishwanath [ Do, 19 Juli 2007 17:48 ] [ ID #1772701 ]

Re: writing a script to simulate keyboard input

On Thu, 19 Jul 2007 11:48:58 -0400, Karthik Vishwanath wrote:

> Hello,
>
> I have to use an archaic, menu-driven C program that requires keyboard
> input to process commands (all of these commands are terminated by a
> newline)
>
> I was wondering if there was any way I could use the program within a
> script so that I could have the script "feed" in the sequence of
> keystrokes/string-inputs that I must otherwise type in manually?
>
> As ever, all help/advice is appreciated.
>
>
> Thanks,
>
> -K
>
> -
> To unsubscribe from this list: send the line "unsubscribe linux-newbie"
> in the body of a message to majordomo [at] vger.kernel.org More majordomo
> info at http://vger.kernel.org/majordomo-info.html Please read the FAQ
> at http://www.linux-learn.org/faqs

As far as I know, this greatly depends on the C program you are trying to
use.
But one thing that doesn't hurt trying, is to pipe it with an echo
command, for instance
echo "command string" | ./program
A pratical example would be to actually count how many leters you have in
abcdef, for this, execute this
echo "abcdef" | wc -c
The | will execute the command that's after the | with the output (I
think) of what's on the left of the |

-
To unsubscribe from this list: send the line "unsubscribe linux-newbie" in
the body of a message to majordomo [at] vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.linux-learn.org/faqs
Mateus Interciso [ Fr, 20 Juli 2007 01:56 ] [ ID #1773750 ]

Re: writing a script to simulate keyboard input

On Thursday 19 July 2007 10:48, Karthik Vishwanath wrote:
> Hello,
>
> I have to use an archaic, menu-driven C program that requires keyboard
> input to process commands (all of these commands are terminated by a
> newline)
>
> I was wondering if there was any way I could use the program within a
> script so that I could have the script "feed" in the sequence of
> keystrokes/string-inputs that I must otherwise type in manually?
>
> As ever, all help/advice is appreciated.

Have you seen Perl's expect module?

>
> Thanks,
>
> -K
>
> -
> To unsubscribe from this list: send the line "unsubscribe linux-newbie" in
> the body of a message to majordomo [at] vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
> Please read the FAQ at http://www.linux-learn.org/faqs

--
Thanks,

Eric
-
To unsubscribe from this list: send the line "unsubscribe linux-newbie" in
the body of a message to majordomo [at] vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.linux-learn.org/faqs
Eric Bambach [ Fr, 20 Juli 2007 00:39 ] [ ID #1773751 ]

Re: writing a script to simulate keyboard input

Karthik Vishwanath wrote:
> Hello,
>
> I have to use an archaic, menu-driven C program that requires keyboard
> input to process commands (all of these commands are terminated by a
> newline)
>
> I was wondering if there was any way I could use the program within a
> script so that I could have the script "feed" in the sequence of
> keystrokes/string-inputs that I must otherwise type in manually?
>
> As ever, all help/advice is appreciated.
>
>
> Thanks,
>
> -K
>
> -
> To unsubscribe from this list: send the line "unsubscribe
> linux-newbie" in
> the body of a message to majordomo [at] vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
> Please read the FAQ at http://www.linux-learn.org/faqs
>
> --
> This email has been verified as Virus free
> Virus Protection and more available at http://www.plus.net
Expect - http://expect.nist.gov/
-
To unsubscribe from this list: send the line "unsubscribe linux-newbie" in
the body of a message to majordomo [at] vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.linux-learn.org/faqs
Benway [ Sa, 21 Juli 2007 01:35 ] [ ID #1774744 ]
Linux » gmane.linux.newbie » writing a script to simulate keyboard input

Vorheriges Thema: Thread IDs
Nächstes Thema: what does this block of code mean?