set script

Use the set script command to

Anyone can display entries in the scripts table. Root privileges are required to configure scripts and display script stanzas.

Also see the set user, set device, set chat, and set modem commands.

Command Syntax

Configuration Syntax

Enter the set script command as shown below to configure or edit a modem or login script:

set script name=name range=range s{1-24}="stanza-content"

Note that the stanza_content value is enclosed in quotation marks.

Display Entries Syntax

Enter the set script command as shown below to display entries in the script table:

set script range=range

Display Stanzas Syntax

Enter the set script command as shown below to display all the stanzas of a script:

set script name=name show=on

Delete a Script

Enter the set script command as shown below to delete a script from a script table.

set script {rmscript=on name=name | rmscript=name

Command Fields

Command Field

Description

name

Specifies the name of the script

range

Specifies one of the following:

  • A range of ports to which this script applies (for configuration)
  • An index number in the script table (for display)

rmscript

Removes the script specified

s{1-24}="stanza-content"

Specifies the number of a script stanza (1 through 24) and the contents of the stanza.

Note: The content of a stanza-content field must be enclosed in quotation marks.

The contents can include any of the following commands:

Anp

Sets

  • Character size to n, which can be either 7 or 8.
  • Parity to p, which can be one of the following values: 0=no parity, 1=odd, 2=even 3=mark

Example: s1="A70"

Bn

Transmits a break signal n milliseconds long. If n is not specified, the length is 250 milliseconds.

Example: s7="B100"

Cn

Sets carrier loss detection. If n=

  • 0, carrier loss is not detected
  • 1, the modem hangs up if the port loses DCD

Example: S2="C1"

D+m

Raises a modem signal. If m is

  • 1, DTR is raised
  • 2, RTS is raised

D-m

Lowers a modem signal. If m is

  • 1, DTR is dropped
  • 2, RTS is dropped

E{string}

Writes the string either to

  • A user terminal (if running interactively)
  • To a trace buffer (if running in the back-ground)

This string can include any of the escape commands listed in Script Escape Commands, which follows this discussion.

Example: S10="E{Please Log In}"

Fn

Pauses for n seconds and flushes input data.

The default is 0.

Example: s1="F10"

Gs

Immediately does one of the following, depending on the value of s. If s is

  • The number of a stanza, control is passed to that stanza
  • + (plus), the script is exited with a success message from E string
  • - (minus) the script is exited with a failure message from E string

Example: s2="G7"

Hs

Sets the carrier lost (hang-up) recovery to stanza s, which is the number identifying another stanza or one of the following:

  • + (plus), which means Exit, indicating success
  • - (minus), which means Exit, indicating a general failure
  • * (star), which means indicate that the remote system is busy
  • = (equal), which means indicate that the remote system is down

Example: s2="H+"

M{string}

Writes string to a modem

Example: s2="M{at&f\c}"

This string can include any of the escape commands listed in Script Escape Commands, which follows this discussion.

Nb

Changes the baud rate. The range is 50 to 115,200. Rates under 110 bps should be used only on expansion ports.

Example: s4="N19200"

Pn

Pauses for n seconds. If you do not specify a value for n, the default is 1 second.

Example: s5="P2"

Qn

Sets software flow control. If n is

  • 0, flow control is disabled
  • 1, flow control is enabled

Example: s5="Q0"

Sn

Defines the time to wait (timeout), in seconds, for a modem signal or input data

Example: s2="S5"

Ts

Defines the timeout recovery state. If the time-out is exceeded, control is passed to this stanza.

Example: s2="T8"

Un

Immediately executes the text of stanza n, as if it were inserted to replace this command. You can nest this command, up to a maximum of 10.

Example: s2="U4"

W+m

Waits for a modem signal to go high. If m is

  • 1, wait for DCD to go high
  • 2, wait for CTS to go high

Example: s6="W+1"

W-m

Waits for a modem signal to go low. If m is

  • 1, wait for DCD to go low
  • 2, wait for CTS to go low

Example: s6="W-1"

string[s]

Defines the string and the stanza to jump to when the string is received on a communications line.

The string can include any of the escape commands listed in Script Escape Commands, which follow this discussion.

Example: s7="[abort]s22"

Script Escape Commands

Introduction

This section describes the escape command you can use in E, M, and [] command strings.

Escape Command Descriptions

Escape Command

Description

^c

This is the character transmitted by an ASCII keyboard when the CTRL key is held down and the c key is pressed.

\b

Backspace

\f

Form feed

\t

Tab

\n

New line

\r

Return

\\

Backslash

}nnn

Octal byte value nnn

\xhh

Hexadecimal byte value hh

%n

A variable, where n is

  • A telephone number whose value comes from the nn field on the set user command
  • one of the following special characters:

* (star), which generates a tone equivalent to dialing * on a touch-tone phone

# (pound), which generates a tone equivalent to dialing # on a touch-tone phone

=, which causes a pause of 2 seconds w, which causes a wait for a secondary dial tone

- (minus), which is completely ignored and not passed to the modem.

%p

A variable, where p is an integer from 1 to 9. For login scripts, the value of p comes from the pn field on the set user command. For dialer scripts, parameters come from the pn field of the set device command.

Command Examples

Displaying the Script Table

In this example, the set script command displays the entire script table.

set script

Displaying Entries in the Script Table

In this example, the set script command displays an entry in the script table.

set script range=4

Displaying all Stanzas in a Script

In this example, the set script command displays all stanzas of the specified script:

set script name=testmodem show=on

Displaying all Stanzas in a Script

In this example, the set script command creates a script called newname and assigns a character size of 8 and no parity.

set script name=newscript ra=4 s1="A80"

Configuring a Login Script

In this example, the set script command defines a login script.

set script name=loginscript

s1="P2[Login:]2 S10 T4"

s2="P1 M{%1\r} S1 [sword:]3 T4"

s3="M{%2\r} G5"

s4="E{login failed} G-"

s5="E{login complete} G+"