Demos

Introduction

Expect for Windows includes a number of demonstration applications to help you get started. These demos are installed in the demos\Expect directory beneath the Tcl installation directory (by default, C:\Tcl\demos\Expect).

The Remote Ls demo and the Wrap Remote Ls (both described in the remotels.tcl section below) are also accessible from the ActiveState Expect for Windows program group on the Windows Start menu. These are the only demos with graphical (as opposed to console) interfaces; therefore, they are the only demos that can be run from the Start menu. The other demos must be run from the command line. The Wrap Remote Ls demo requires that the Tcl Dev Kit is installed, as it uses TclApp for wrapping.

The instructions for running these demos assume that the Tcl\bin directory is in your system's PATH environment variable. If this is not the case, in the instructions for running the demos, substitute the full path to the tclsh interpreter.

Top

beer.tcl

This demo is a simple application that "sings" (types) 99 Bottles of Beer on the Wall in the manner of a singing, beer-drinking typist, with predictable degradation as more bottles of beer are consumed.

To run the demo, change to the Expect demos directory (by default, C:\Tcl\demos\Expect) and enter:

    
    tclsh beer.tcl
Top

ftp-rfc.tcl

This demo retrieves an RFC standard by number from the uunet ftp archive. Alternatively, the -index switch can be used to request an index of documents.

To run the demo, change to the Expect demos directory (by default, C:\Tcl\demos\Expect) and enter:

    
    tclsh ftp-rfc.tcl rfc-number

...or...

    
    tclsh ftp-rfc.tcl -index

Note that individual RFCs and the index are downloaded in "compress" format (.Z), and must be uncompressed before reading.

Top

remotels.tcl

This demo logs in to a remote host and lists the contents of the current directory. It is fully described in the Expect for Windows Tutorial.

To run the demo, change to the Expect demos directory (by default, C:\Tcl\demos\Expect) and enter:

    
    tclsh remotels.tcl

This will display a list of the switches that are used for specifying the host, user name, password, etc.

tkremotels.tcl

This demo is similar to the "remotels.tcl" demo, except it has a graphical Tk front-end. To run the demo, enter:

    wish tkremotels.tcl

Alternatively, from the Windows Start menu, select ActiveState Expect for Windows | Expect Demos | Remote Ls.

tkremotels.tpj

If you are using ActiveState's Tcl Dev Kit, the "tkremotels.tpj" project file can be opened using the TDK's TclApp. TclApp uses the project file to build a standalone executable that contains the tkremotels script.

To open, load the "tkremotels.tpj" project file within TclApp, or, from the Windows Start menu, select ActiveState Expect for Windows | Expect Demos | Wrap Remote Ls (which will automatically launch TclApp).

Top

timed-read.tcl

This demo waits for input from STDIN, aborting if input is not received with the specified timeout value (which is, by default, 10 seconds).

To run the demo, change to the Expect demos directory (by default, C:\Tcl\demos\Expect) and enter:

    
    tclsh timed-read.tcl
Top

timed-run.tcl

This demo runs a specified external program for a specified amount of time. The program is aborted when the specified time is reached.

To run the demo, change to the Expect demos directory (by default, C:\Tcl\demos\Expect) and enter:

    
    tclsh timed-read.tcl time(seconds) program program_args
Top

weather.tcl

This demo retrieves US weather data from an open server. It accepts a three-character National Weather Service region code (or a two-character state code, which returns the associated region code) as input.

To run the demo, change to the Expect demos directory (by default, C:\Tcl\demos\Expect) and enter:

    
    tclsh weather.tcl state | region

The two-character state abbreviation (eg CA = California) returns a list of three-character abbreviations of National Weather Service regions for that state. The three-character region abbreviation returns the weather for that region.

weather.tpj

If you are using ActiveState's Tcl Dev Kit, the "weather.tpj" project file can be opened using the TDK's TclApp. TclApp uses the project file to build a standalone executable that contains the tkremotels script.

Top