Exercises, examples and other material relating to training module T242. This topic is presented on public courses
Learning to program in Tcl,
Tcl Programming,
Tcl Programming
Expect has a number of advanced facilities like the ability to slow down its output to mimic a human operator more closely, and to be able to handle signals. This module covers these facilities and more.
Related technical and longer articles
The Typist and the Engineer
Articles and tips on this subject | updated |
3448 | Checking all the systems on a subnet, using Expect and Tk There are times that we want to check the connectivity of all the systems on our subnet - to see which machines are present, and which are not. Pinging them one at a time is a bit slow, but pinging them all at once in a simple script sets up too many connections and the script is likely to fall over. ... | 2011-09-18 |
3009 | Expect in Perl - a short explanation and a practical example Around 20% of delegates on our Tcl Courses are using Tcl because of the Expect package that extends it to "choreograph" interaction with other systems and processes, and yet the Expect module in Perl (Expect.pm) is decidedly niche and we cover it on our Perl for Larger Projects course only on request. ... | 2010-10-22 |
2475 | Quick easy and dangerous - automated logins via Tcl / Expect Let me start with a security warning. Passwords and firewalls are there to make it difficult for unauthorized users to get through / at systems, and if you write a script which automates passwords and multi-hop telnet and ssh logins to make it quick and easy for you to get over all the hurdles you are ... | 2009-10-24 |
1531 | Expecting a item from a list of possibles There are times (and they're quite frequent!) that I'm asked a good question that's so good it's worth sharing the answer. Actually, that makes up a fair proportion of my inspirations for this spot, such as today's.
In Expect - the command line automation tool of the Tcl language - you can tell the ... | 2008-02-05 |
1475 | Tcl/Tk - updating your display while tasks are running Let me make two statements:
1. When you are popping up a new window from your program, the very last thing you want to see happen is for the window to gradually appear, with bits of it being resized as it comes on the screen - not only is such an operation irritating on the eye, but also it's burning ... | 2007-12-16 |
1411 | 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) ... | 2007-10-30 |
1173 | Cheat Sheet / Check list for Expect maintainers Programming in Expect can be very different (and more challenging) than conventional programming. Rather than write code (structured, if you like) through a series of events, you'll do better to start off with a co-operation diagram of the process that you want to automate [[For the newcomer, Expect ... | 2007-05-03 |
435 | Expect for Windows I've just noticed on the Activestate site that "the ActiveTcl distribution now includes Expect for Windows. A license is no longer required ....". At face value, that looks like excellent news!
One of the big uses of Tcl and Tcl/Tk is in the automation of processes / programs that are designed to ... | 2006-06-05 |
Examples from our training material
chammy | Automated Logging In |
engineer | send_human in expect |
immortal | Catching signals in expect |
multisigs | Trapping multiple signals in Expect |
pingabout | Expect to run ping on a named host; able to switch host during run |
rupple | Expect - run rup on a named host |
sslo | Send slow example - expect |
subnet_test | Check a subnet for pingable systems |
tcenhance | Telnet wrapper using interact; provides filtering too |
tctel | Telnet wrapper using interact |
typist | Second example of expect's "send_human" command. |
Pictures
Network testing through Expectk
Background information
Some modules are
available for download as a sample of our material or under an
Open Training Notes License for free download from
[here].
Topics covered in this module
Expecting from the user.
Using expect and send for user communication.
Waiting for the user or for a process.
More facilities.
Defining default expect patterns.
Humanesque input.
Sending Specials.
Signals.
Receiving signals.
Sending Signals.
Command line options.
Interact.
Filtering throughput.
Complete learning
If you are looking for a complete course and not just a information on a single subject, visit our
Listing and schedule page.
Well House Consultants specialise in training courses in
Tcl/Tk, Expect,
Ruby,
Lua,
Python,
Perl,
PHP, and
MySQL. We run
Private Courses throughout the UK (and beyond for longer courses), and
Public Courses at our training centre in Melksham, Wiltshire, England.
It's surprisingly cost effective to come on our public courses -
even if
you live in a different
country or continent to us.
We have a technical library of over 700 books on the subjects on which we teach.
These books are available for reference at our training centre.