Re: utter newbie expect question
- From: Mark Janssen <mpc.janssen@xxxxxxxxx>
- Date: 29 May 2007 10:11:31 -0700
On May 29, 5:43 pm, Artis Gripemore <wealthe...@xxxxxxxxx> wrote:
Let me start by declaring that had I access to the Exploring book, I
would not be here posting this, I'd be figuring it out for myself and
leaving you to more interesting problems. Thanks for your patience
and any help you can offer.
My problem is that the application I want to control could generate,
at one point in its execution, any number (from 0 to 1000) "Press
<Space> to Continue" prompts, and I cannot for the life of me figure
out how to write an expect script that will deal with this. I need it
to send " " when this prompt appears, then check to see if it gets
that prompt again before it moves on, until it no longer gets that
prompt.
So it looks like this:
expect "(A, B, C"
send -- "c"
# at this point, we can get any number of "Press <Space>" prompts, to
which we need to send " " after capturing the response each time.
expect "(X, Y, Z"
send -- "y"
etc.
Thanks!
Something like:
expect {
"<Space> to Continue" {send " " ; exp_continue}
"(X, Y, Z" {send -- "y"}
}
Should do the trick. This will wait for either "(X, Y, Z" and send yes
or wait for the <Space> line and send a space in response and then
wait for either a <Space> line or a X, Y, Z line again.
Mark
.
- Follow-Ups:
- Re: utter newbie expect question
- From: Artis Gripemore
- Re: utter newbie expect question
- References:
- utter newbie expect question
- From: Artis Gripemore
- utter newbie expect question
- Prev by Date: Re: What's the difference in this "string match"ing ...
- Next by Date: Re: tcllib jpeg package and JPEG comments ...
- Previous by thread: utter newbie expect question
- Next by thread: Re: utter newbie expect question
- Index(es):
Relevant Pages
|