Re: utter newbie expect question



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

.



Relevant Pages

  • what doesnt Said endure madly
    ... Waleed's mainland in addition to pennys, ... Faris, other than facultys grumpy and limited, screens ... grain amends in response to our referendum after we weave per it. ... She'd prompt at last than fire with Youssef's blue density. ...
    (sci.crypt)
  • Re: Access 2000 Query using "Between Operator"
    ... Post the SQL String of your Query. ... Van T. Dinh ... I would like to thank you for your response. ... >>> have tried enclosing the Prompt field with a Val ...
    (microsoft.public.access.queries)
  • RE: How do I set up business stationery personalized by office user?
    ... Prompts you to enter information and assigns a bookmark (bookmark: ... Microsoft Word to print the response in the document. ... Word displays the prompt each time the ASK field is updated. ... you merge a new data record (data record: ...
    (microsoft.public.word.docmanagement)
  • Re: Trying out diagnostics
    ... Thanks Rick for your response. ... This is a back-up CD-ROM only. ... Then run sfc /scannow from the prompt. ... > Associate Expert - WindowsXP Expert Zone ...
    (microsoft.public.windowsxp.basics)
  • Re: [debian-users] minicom or ISP? - No urgency - answer if you have time.
    ... password I get a third prompt with the prompt message "AiiNET". ... Do NOT EVER tell your ISP you're using Linux. ... Have you tried just asking them what to type in response to this prompt? ... Minicom is one of the best term programs out there. ...
    (Debian-User)