select-connection

Description

Closes the current connection (disconnect) and invokes immediately another connection, as specified in the parameter.

Syntax

select-connection predefined-connection-name

Notes

The user must have permission to access the desired connection.

Example

Closes the current connection and connects immediately to the pre-defined connection named Development - Builder.

select-connection "Development - Builder"

send

Description

Send data to the host.

Syntax

send data

Notes

Sends data as though it was typed from the keyboard.

Returns

Returns an empty string.

Example

The host receives the following data and shows the current directory:

send "dir^M"

Note

§         "^M" sends ctrl-m. The "^" sign followed by a letter represents the control code of that letter.

session

Description

Modify the communication session status.

Syntax

session option

Notes

Performs one of several session operations, depending on option. The legal options are:

session open

Opens a session according to communication parameters previously defained with the set command.

session modify

Modifies the current session according to communication parameters previously defained with the set command.

session close

Closes the current session.

Returns

Returns an empty string.

Examples

1          Opens a COM session with the following parameters:

set comm-type com

set port-number 2

set baud-rate 19200

set protocol-type xonxoff

session open

2          Modifies the COM session to 9600 baud-rate:

set baud-rate 9600

session modify

3          Opens the setup file "abc.pts" for working with specific PowerTerm parameters for the "abc" host (similar to the Open command on the File menu). Then opens a Telnet session to host "abc" (similar to the Connect command on the Communication menu).

open-setup-file abc.pts

set comm-type telnet

set host-name abc

session open

4                      Opens a lat session to host "abc" through DIGITAL PATHWORKS 32:

set comm-type lat

set service-name abc

session open

5                      Opens a lat session to host "abc" through Novell's NetWare for LAT:

set comm-type lat

set server-name NovellServerName

set service-name abc

session open

6                      Closes the current session.

session close

Note

§         In order to automatically connect to a host, make the appropriate script. Click Properties on the File menu in the Program Manager and add the name of the script (with parameters) to the Command Line. Every time the icon is clicked, PowerTerm will run the script and open the session.

Consider the following script, named "telnet.psl", to connect to a host with telnet protocol:

  set comm-type telnet

  set host-name $p1

  session open

Click Properties on the File menu, and enter:

  C:\PTW\PTW.EXE telnet.psl HostName

Every time you click the icon, "telnet.psl" will execute and connect to HostName.

In this manner you can create several icons for automatic connection to all your organization computers.

 

set

Description

Set a new value to a PowerTerm parameter.

Syntax

set parameter value [value2]

Notes

Sets a new value to one of the PowerTerm parameters.

set baud-rate value

Sets the serial communication baud rate to one of the following values:

  300, 600, 1200, 1800, 2400, 3600, 4800, 7200,

  9600, 14400, 19200, 38400, 57600, 115200.

set block-paste on | off

Enables the block-paste mode algorithm.

set end-of-medium cr | crlf | ff

Sets the end-of-medium printing mode (IBM printer emulations only).

set func-hotspot-rows start end

Sets the range of rows in which function hotspots are enabled.

Applicable only for IBM emlulations.

The value of zero for either start or end means to ignore. Negative values can be used in order to back track from the last line of the screen.

set mark-func-only on | off

Enables function hotspots to mark only the function key’s name

set func-hotspot-rows start end

Sets the range of rows in which function hotspots are enabled.

Applicable only for IBM emlulations.

The value of zero for either start and end  means to ignore. Negative values can be used in order to back track from the last line of the screen.

set mark-func-only on | off

Enables function hotspots to mark only the function key’s name.

set menu-hotspot-rowsstart end

Sets the range of rows in which menu hotspots are enabled.

Applicable only for IBM emlulations.

The value of zero for either start and end  means to ignore.

Valid values start from row 1.

set print-direction r2l | l2r

Sets the print direction right-to-left (r2l) or left-to-right (l2r).

Applicable only for Hebrew version.

set protocol-type value

Sets the serial communication protocol type to one of the following values: none, xonxoff, hardware.

set parity bits type

Sets the serial communication parity bits and type to one of the following values:

  bits:    7, 8.

  type:   none, even, odd, mark, space.

set stop-bits value

Sets the serial communication stop bits to one of the following values: 1, 2.

set comm-type value

Sets the communication type to one of the following values:

  com:   Serial communication.

  int14: Communication with BIOS interrupt 14.

  lat:      Network communication with DIGITAL LAT.

  cterm:             Serial communication with DIGITAL CTERM.

  telnet:             Network communication with Tcpip Telnet.

  nwlat:             Network communication NetWare for LAT.

set port-number value

Sets the serial communication port number to one of the following values: 1, 2, 3, 4.

set print-screen-convert no_convert | ibm | digital | graphics

Sets the print screen conversion mode.

set host-name string

Sets the telnet and cterm communication host name.

set screen-output on | off

Disables/enables the output to the screen. When the set screen-output off command is used in a login script, the opposite command set screen-output on is implicitly applied when the script finishes.

The command wait must precede the command set screen-output on or the end of the script.

set service-name string

Sets the lat communication service name (may also specify a host name).

set user-name string

Sets the NetWare for LAT user name.

set server-name string

Sets the NetWare for LAT user name.

set session-name string

Sets the communication session name on the emulation's title bar.

Returns

Returns an empty string.

 

set slave-printer-convert no_convert | ibm | digital | graphics

 

Sets the slave printer conversion mode.  

 

set slave-printer-delimiter decimal-ascii-code

 

set vt-hotspots on | off

Activates the VT hotspots (VT emulation).

 

set wyse-esc-b on | off

Ignores the escape sequence esc-b (Wyse emulation).

 

split

Description

Split a string into a proper PSL list.

Syntax

split string [splitChars]

Notes

Returns a list created by splitting string at each character that is in the splitChars argument. Each element of the result list will consist of the characters from string that lie between instances of the characters in splitChars. Empty list elements will be generated if string contains adjacent characters in splitChars, or if the first or last character of string is in splitChars. If splitChars is an empty string, then each character of string becomes a separate element of the result list. SplitChars defaults to the standard white-space characters.

Returns

Returns the split string.

Examples

split "comp.unix.misc" "."

returns "comp unix misc"

split "Hello world" ""

returns "H e l l o { } w o r l d"

string

Description

Manipulate strings.

Syntax

string option arg [arg ...]

Notes

Performs one of several string operations, depending on option. The legal options (which may be abbreviated) are:

string compare string1 string2

Performs a character-by-character comparison of strings string1 and string2 in the same way as the C strcmp procedure. Returns -1, 0, or 1, depending on whether string1 is lexicographically less than, equal to, or greater than string2.

string first string1 string2

Searches string2 for a sequence of characters that exactly match the characters in string1. If found, returns the index of the first character in the first such match within string2. If not found, returns -1.

string index string charIndex

Returns the charIndex'th character of the string argument. A charIndex of 0 corresponds to the first character of the string. If charIndex is less than 0 or greater than or equal to the length of the string, then an empty string is returned.

string last string1 string2

Searches string2 for a sequence of characters that exactly match the characters in string1. If found, returns the index of the first character in the last such match within string2. If there is no match, then returns -1.

"string last ab 123abc456ab12", will return 9.

string length string

Returns a decimal string giving the number of characters in string.

string match pattern string

If pattern matches string, returns 1, if it does not, returns 0. For the two strings to match, their contents must be identical except that the following special sequences may appear in pattern:

*

Matches any sequence of characters in string, including a null string.

?

Matches any single character in string.

[chars]

Matches any character in the set given by chars. If a sequence of the form x-y appears in chars, then any character between x and y, inclusive, will match.

\x

Matches the single character x. This provides a way of avoiding the special interpretation of the characters *?[]\e in pattern.

string range string first last

Returns a range of consecutive characters from string, starting with the character whose index is first and ending with the character whose index is last. An index of 0 refers to the first character of the string. Last may be end to refer to the last character of the string. If first is less than zero, then it is treated as if it were zero, and if last is greater than or equal to the length of the string, then it is treated as if it were end. If first is greater than last, then an empty string is returned.

string tolower string

Returns a value equal to string except that all uppercase letters have been converted to lower case.

string toupper string

Returns a value equal to string except that all lowercase letters have been converted to upper case.

string trim string [chars]

Returns a value equal to string except that any leading or trailing characters from the set given by chars are removed.

If chars is not specified, then white space is removed (spaces, tabs, newlines, and carriage returns).

string trimleft string [chars]

Returns a value equal to string except that any leading characters from the set given by chars are removed. If chars is not specified, then white space is removed (spaces, tabs, newlines, and carriage returns).

string trimright string [chars]

Returns a value equal to string except that any trailing characters from the set given by chars are removed. If chars is not specified, then white space is removed (spaces, tabs, newlines, and carriage returns).

Returns

Returns the converted string.

Example

Returns "UNIX".

string toupper Unix

switch

Description

Evaluate one of several scripts, depending on a given value.

Syntax

switch [options] string [pattern body [pattern body ...]]

or

switch [options] string {pattern body [pattern body...]}

Notes

The switch command matches its string argument against each of the pattern arguments in order.

As soon as it finds a pattern that matches string, it evaluates the following body argument by passing it recursively to the PSL interpreter and returns the result of that evaluation.

If the last pattern argument is default, then it matches anything.

If no pattern argument matches string and no default is given, then the switch command returns an empty string.

If the initial arguments to switch start with "-", then they are treated as options. The following options are currently supported:

-exact

Use exact matching when comparing string to a pattern. This is the default.

-glob

When matching string to the patterns, use glob-style matching (i.e. the same as implemented by the string match command).

-regexp

When matching string to the patterns, use regular expression matching (i.e. the same as implemented by the regexp command).

--

Marks the end of options. The argument following this one will be treated as string even if it starts with a "-".

Two syntaxes are provided for the pattern and body arguments.

The first uses a separate argument for each of the patterns and commands. This form is convenient if substitutions are desired on some of the patterns or commands.

The second form places all of the patterns and commands together into a single argument. The argument must have proper list structure, with the elements of the list being the patterns and commands.

The second form makes it easy to construct multiline switch commands, because the braces around the whole list make it unnecessary to include a backslash at the end of each line.

Since the pattern arguments are in braces in the second form, no command or variable substitutions are performed on them. This makes the behavior of the second form different than the first form in some cases.

If a body is specified as "-'', it means that the body for the next pattern should also be used as the body for this pattern (if the next pattern also has a body of "-", then the body after that is used, and so on). This feature makes it possible to share a single body among several patterns.

Returns

Returns the output of the last command of the executed in body.

Example

switch abc a-b {format 1} abc {format 2} default {format 3}

will return "2".

switch -regexp aaab {

  ^a.*b$           -

  b                                {format 1}

  a*                              {format 2}

  default           {format 3}

}

will return "1".

switch xyz {

  a                                -

  b                                {format 1}

  a*                              {format 2}

  default           {format 3}

}

will return "3".

tell

Description

Return current access position for an open file.

Syntax

tell fileId

Notes

Returns a decimal string giving the current access position in fileId.

FileId must have been the return value from a previous call to open.

Returns

Returns the file position.

Example

Opens a file and Reads twice 10 bytes. tell will return "20":

fileId = [open data"]

read $fileId 10

read $fileId 10

position = [tell $fileId]

close $fileId

time

Description

Time the execution of a script.

Syntax

time scriptCommand count

Notes

Calls the PSL interpreter count times to evaluate scriptCommand (or once if count is not specified). It then returns a string of the form "503 microseconds per iteration", which indicates the average amount of time required per iteration, in microseconds.

Time is measured in elapsed time, not CPU time.

Returns

Returns the elapsed time of a PSL command.

Example

Displays the average elapsed time of "run test.psl" command:

message [time "run test.ppl" 100]

unset

Description

Delete variables.

Syntax

unset name [name ...]

Notes

This command removes one or more variables.

Each name is a variable name, specified in any of the ways acceptable to variable assignment.

If a name refers to an element of an array, then that element is removed without affecting the rest of the array.

If a name consists of an array name with no parenthesized index, then the entire array is deleted.

An error occurs if any of the variables does not exist, and any variables after the nonexistent one are not deleted.

Returns

Returns an empty string.

Example

Sets and then deletes variable a:

a = abc

unset a

uplevel

Description

Execute a script in a different stack frame.


Syntax

uplevel [level] arg [arg ...]

Notes

All of the arg arguments are concatenated as if they had been passed to concat. The result is then evaluated in the variable context indicated by level. uplevel returns the result of that evaluation.

If level is an integer, then it gives a distance to move (up the procedure calling stack) before executing the command. If level consists of "#" followed by a number, then the number gives an absolute level number. If level is omitted, then it defaults to 1. Level cannot be defaulted if the first command argument starts with a digit or "#".

Returns

Returns the result of the evaluation.

Example

Suppose that procedure a was invoked from top-level, and that it called b, and that b called c.

Suppose that c invokes the uplevel command. If level is 1 or #2 or omitted, then the command will be executed in the variable context of b. If level is 2 or #1, then the command will be executed in the variable context of a.

If level is 3 or #0, then the command will be executed at top-level (only global variables will be visible).

The uplevel command causes the invoking procedure to disappear from the procedure calling stack while the command is being executed.

In the above example, suppose c invokes the command

uplevel 1 {x = 43; d}

where d is another PSL procedure. The "x = 43" command will modify the variable x in b's context, and d will execute at level 3, as if called from b. If it in turn executes the command

uplevel {x = 42}

then the "x = 42" command will modify the same variable x in b's context: the procedure c does not appear to be on the call stack when d is executing. The command "info level" may be used to obtain the level of the current procedure.

uplevel makes it possible to implement new control constructs as PSL procedures (for example, uplevel could be used to implement the while construct as a PSL procedure).