writing a script to simulate keyboard input

writing a script to simulate keyboard input

am 19.07.2007 17:48:58 von Karthik Vishwanath

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@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

Re: writing a script to simulate keyboard input

am 20.07.2007 00:39:35 von Eric Bambach

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@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@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

Re: writing a script to simulate keyboard input

am 20.07.2007 01:56:00 von Mateus Interciso

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@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@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

Re: writing a script to simulate keyboard input

am 21.07.2007 01:35:06 von Benway

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@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@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