Home Accessibility Courses Twitter The Mouth Facebook Resources Site Map About Us Contact
 
For 2021 - online Python 3 training - see ((here)).

Our plans were to retire in summer 2020 and see the world, but Coronavirus has lead us into a lot of lockdown programming in Python 3 and PHP 7.
We can now offer tailored online training - small groups, real tutors - works really well for groups of 4 to 14 delegates. Anywhere in the world; course language English.

Please ask about private 'maintenance' training for Python 2, Tcl, Perl, PHP, Lua, etc.
Buffering of inputs to expect, and match order

If you're using the expect command to wait for one of a series of inputs within your expect program, information will be checked in the program's internal buffers inthe following order:
a) Any string that matches expect_before will be found
b) Matches to each of the possible patterns in expect in turn
c) Matches to expect_after.

Note that you can't be certain how much information will have been written to the internal buffer up to any point, so you need to exercise care when specifying the possible sequences.

Once expect_before expect_after or expect matches as string, the section up to that string is transferred to the expect_out(buffer) variable that you can reference in your continuing Tcl, and that section is removed from the internal bugger. The following expect command will start looking from where the previous successful match was found.

Note that the -notransfer option to expect will prevent the matched section from being removed from the internal buffer.

The expect_background command allows you to specifiy an expect command that runs, in effect, in an asyncronous background loop. You can use it to receive inputs from processes that may be responding from time to time while you're doing other processing in the foreground, without having to go into a wait loop until one of those background processes responds.
(written 2007-10-27, updated 2007-10-30)

 
Associated topics are indexed as below, or enter http://melksh.am/nnnn for individual articles
T242 - Tcl/Tk - More on Expect
  [435] Expect for Windows - (2005-09-04)
  [1173] Cheat Sheet / Check list for Expect maintainers - (2007-05-02)
  [1475] Tcl/Tk - updating your display while tasks are running - (2007-12-16)
  [1531] Expecting a item from a list of possibles - (2008-02-04)
  [2475] Quick easy and dangerous - automated logins via Tcl / Expect - (2009-10-24)
  [3009] Expect in Perl - a short explanation and a practical example - (2010-10-22)
  [3448] Checking all the systems on a subnet, using Expect and Tk - (2011-09-18)

T211 - Tcl/Tk - What is Expect? Why use it?
  [286] Automating regular manual procedures - (2005-04-21)
  [1174] Installing Tcl and Expect on Solaris 10 - a checklist - (2007-05-02)
  [1409] What is Expect? - (2007-10-26)
  [1469] Curley brackets v double quotes - Tcl, Tk, Expect - (2007-12-12)
  [1602] Automating processes through Expect - (2008-04-05)
  [2474] Using Tcl and Expect to automate repetitive jobs - (2009-10-24)
  [2489] Parallel Pinging, using Python Threads or Expect spawn lists - (2009-11-02)
  [3286] Should we cover expect and/or Tk on our public Tcl courses? - (2011-05-11)
  [3572] Adding Expect on top of Tcl - what is it and where can I get a training course to learn about it? - (2012-01-08)
  [4405] Backup procedures - via backup server - (2015-01-24)
  [4678] Expect with Ruby - a training example to get you started - (2016-05-18)


Back to
Tcl / regsub - changing a string and using interesting bits
Previous and next
or
Horse's mouth home
Forward to
Sparse and Greedy matching - Tcl 8.4
Some other Articles
Better technology makes for longer commutes?
What we teach - expained for the non-technical
The little gestures that can really count
Sparse and Greedy matching - Tcl 8.4
Buffering of inputs to expect, and match order
Tcl / regsub - changing a string and using interesting bits
Wireless hotel tips - FTP and Skype connections failing
Reading from another process in Tcl (pipes and sockets)
Away or home - which do I prefer?
4759 posts, page by page
Link to page ... 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96 at 50 posts per page


This is a page archived from The Horse's Mouth at http://www.wellho.net/horse/ - the diary and writings of Graham Ellis. Every attempt was made to provide current information at the time the page was written, but things do move forward in our business - new software releases, price changes, new techniques. Please check back via our main site for current courses, prices, versions, etc - any mention of a price in "The Horse's Mouth" cannot be taken as an offer to supply at that price.

Link to Ezine home page (for reading).
Link to Blogging home page (to add comments).

You can Add a comment or ranking to this page

© WELL HOUSE CONSULTANTS LTD., 2021: 48 Spa Road • Melksham, Wiltshire • United Kingdom • SN12 7NY
PH: 01144 1225 708225 • EMAIL: info@wellho.net • WEB: http://www.wellho.net • SKYPE: wellho

PAGE: http://www.wellho.net/mouth/1411_Buf ... order.html • PAGE BUILT: Sun Oct 11 16:07:41 2020 • BUILD SYSTEM: JelliaJamb