Re: utter newbie expect question
- From: Bezoar <cwjolly@xxxxxxxxx>
- Date: 29 May 2007 11:54:57 -0700
On May 29, 1:40 pm, Artis Gripemore <wealthe...@xxxxxxxxx> wrote:
Thanks very much! I suppose if I put a ;return after the send -- "y"
that I could break out of this, if I had more script to run after the
match on X, Y, Z?
"(X, Y, Z" {send -- "y" ;return}
Otherwise, it would continue with the next expect statement anyway,
once it timed out, correct?
Thanks again!
On May 29, 1:11 pm, Mark Janssen <mpc.jans...@xxxxxxxxx> wrote:
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- Hide quoted text -
- Show quoted text -
Actually the way the script is written the first time you send "y" you
will
leave the script no return needed. You will only do the send once. By
default expect
does not loop unless you have exp_continue.
Carl
.
- References:
- utter newbie expect question
- From: Artis Gripemore
- Re: utter newbie expect question
- From: Mark Janssen
- Re: utter newbie expect question
- From: Artis Gripemore
- utter newbie expect question
- Prev by Date: Re: utter newbie expect question
- Next by Date: Re: utter newbie expect question
- Previous by thread: Re: utter newbie expect question
- Next by thread: tcllib jpeg package and JPEG comments ...
- Index(es):
Relevant Pages
|