Quick Start        Pattern Matching       Commands      LAPIS Home


L A P I S

Command Reference

This page lists the script commands recognized by LAPIS, in alphabetical order. Only the new commands defined by LAPIS are described here.  For more about Tcl, the scripting language used by LAPIS, consult these other references:

Back

back [n]
Backs up to the previous document in the page history. The optional argument n is the number of pages to back up. This command has the same effect as the Back toolbar button.

Calc

calc pattern

     [-count]

     [-sum]

     [-average|-mean|-avg]

     [-min]

     [-max]

     [-stddev]

Calculates statistics on the regions matching pattern. Only numeric regions are included in the statistics; nonnumeric regions are ignored. The statistics returned depend on which options are given: If only one option is given, then calc returns only the computed value. If multiple options are given, then calc returns a Tcl list of values in the order the options were given. If no options are given, calc computes all the statistics and returns a formatted display.

Click

click pattern
Clicks on the hyperlink or form control described by pattern. Throws a Tcl exception if pattern does not match exactly one hyperlink or form control.

Count

count pattern
Returns the number of matches to pattern.

Delete

delete pattern
Deletes all regions matching pattern. Synonym for omit.

Doc

doc [string]
Returns the current document
doc string [-type type]
Sets the current document to string. With -type, the document is created with content type type. Possible content types are text and html. Without this argument, the content type is guessed from the content of string, defaulting to text if no valid HTML tags are found.

Enter

enter pattern value
Sets all form fields matching pattern to the value value.

Exec:

exec:command
Runs command as an external program.

Extract

extract pattern 

        [-startswith start]

        [-endswith end]

        [-separatedby sep]

        [-as type]

Extracts all regions matching pattern.

File:

file:filename
Loads the file named filename and returns it as the current document.

Forward

forward [n]
Goes forward to the next document in the page history. The optional argument n is the number of pages to go forward. This command has the same effect as the Forward toolbar button.

Ftp:

ftp://hostname/pathname
Retrieves a file by FTP and returns it as the current document.

History

history
Prints the page history to standard output. This command is designed for the LAPIS typescript shell (lapis -tty), which would otherwise have no other way to show the history.

Http:

http://hostname/pathname
Retrieves a web page by HTTP and returns it as the current document.

Insert

insert pattern string
Inserts string at all points matched by pattern. Synonym for replace.

Keep

keep pattern [-outof recordpattern]
Keeps only records matching pattern and deletes the rest.

Omit

omit pattern
Deletes all regions matching pattern.

Parse

parse parser
Binds the patterns described by parser into the pattern library. The parser can be one of three possibilities:

Property

property [-get] name
Returns the value of the property named name on the current document.
property -set name value
Sets the name property to value.
property -list
Returns a Tcl list of the property names defined on the current document.

Relocate

relocate

   [-base url]

   [-override]

Adds the HTML element <base href=url> to the current document. The url is obtained as follows:
  1. From the -base argument, if specified.
  2. From the base property of the current document, if any.
  3. From the url property of the current document, if any.
If none of these can be found, relocate makes no change to the current document. If the current document already has a <base> element, relocate does nothing unless the -override option forces it to replace the existing <base>.

Replace

replace pattern template
Replaces all regions matching pattern with template. The template may include embedded pattern substitutions surrounded by curly braces.

Save

save [filename]

     [-backup extension]

Saves the current document to filename, or to the file the current document was loaded from if no filename is specified.

If the file already exists, the old contents are backed up to filename by default. The -backup option changes the backup extension from to extension. If extension is the empty string, backup is disabled.

Show

show [-brief] [-all]
Prints the content of the current document to standard output. This command is designed for use in the LAPIS typescript shell (lapis -tty) and for scripts run from the command line.

Sort

sort pattern

     [-by keypattern]

     [-order [reverse] dictionary|numeric|unicode|random]

Sorts the regions matching pattern. Multiple sort keys may be specified with multiple -by and -order arguments.

Submit

submit [-form formpattern]

       [-button buttonpattern]

Submits a web form in the current page.
Go to the LAPIS home page.
Send comments or questions to Rob Miller, (rcm@lcs.mit.edu)
Copyright©2003 - Massachusetts Institute of Technology. All Rights Reserved.