pw:: Script

Global actions for controlling script behavior

Derives From

pw::Object

Summary
Global actions for controlling script behavior
This attribute is a flag for whether the Glyph Server is actively listening for client connections or not.
This attribute is the TCP port number of that the Glyph Server listens on for client connections.
This attribute is an authentication code used to authenicate the clients that attempt to connect to the Glyph Server.
This action processes incoming messages to the Glyph Server, which allows executing Glyph commands in Pointwise over a TCP port.
This action includes and executes the specified Glyph file with its own undo level.
This action loads and initializes the Tk library for use in the script.

Static Attributes

ServerActive

pw::Script get/setServerActive active

This attribute is a flag for whether the Glyph Server is actively listening for client connections or not.

Type

This attribute is a boolean value.

Default

The default for this attribute is true or the value of the PWI_GLYPH_SERVER_ACTIVE environment variable, if it set.

Information

If this attribute is set to true and the current ServerPort is already in use, an alternate port that is not currently in use will be used, and the ServerPort attribute will be updated.

Errors

This attribute cannot be set in non-interactive mode or through a Glyph Server connection.

ServerPort

pw::Script get/setServerPort port

This attribute is the TCP port number of that the Glyph Server listens on for client connections.

Type

This attribute is an integer with the range [1025, 65536].

Default

The default for this attribute is 2807 or the value of the PWI_GLYPH_SERVER_PORT environment variable, if it set.  However, if the default port is in use by another application, a random port number that is unused will be assigned.

Information

If this attribute is modified and the Glyph Server is currently active it will be deactivated temporarily, the port changed and reactived.  It is possible that errors will occur during this process leading to the Glyph Server becoming deactived.

Errors

This attribute cannot be set through a Glyph Server connection.

ServerAuthentication

pw::Script get/setServerAuthentication code

This attribute is an authentication code used to authenicate the clients that attempt to connect to the Glyph Server.

Type

This attribute is a string with maximum length of 40.

Default

The default for this attribute is an empty string or the value of the PWI_GLYPH_SERVER_AUTH environment variable, if it set.

Errors

This attribute cannot be set through a Glyph Server connection.

Static Actions

processServerMessages

pw::Script processServerMessages ?-authentication code? ?-timeout seconds?

This action processes incoming messages to the Glyph Server, which allows executing Glyph commands in Pointwise over a TCP port.

Parameters

-authentication codeThis optional parameter is the string authentication code that clients must use to communicate with the server.  The default is the current value of the ServerAuthentication parameter.
-timeout secondsThis optional parameter is the integer number of seconds to wait for a client connection.  The default is -1, which specifies that it will wait indefinitely.

Information

The Glyph Server protocol is a simple message based TCP protocol for executing glyph commands given by a client that connects to the Glyph Server.  Each message sent to or from the server consists of a 4 byte network ordered (big-endian) unsigned integer with the value representing the length of the following message in bytes.

Each message is further defined as starting with an 8 byte string denoting the type of message with spaces padding on the right, followed by a variable length string payload.

After a client connects, it should immediately send an authentication message:

  • type: AUTH, payload: the authentication string

After the AUTH message has been sent, the server will send one of three messages:

  • type: READY, payload: Empty
  • type: AUTHFAIL, payload: Empty
  • type: BUSY, payload: Empty
  • type: ERROR, payload: error description

The READY message signals to the client that messages will be accepted from the client by the server.  The AUTHFAIL message will be send if the client couldn’t not be authenticated.  The BUSY message will be sent when another client is currently connected to the Server or the Pointwise application is otherwise busy.  The ERROR message will be sent for any other issue not covered by the above cases for which an established connection did not occur.

After the READY message has been returned, the client may send one or more of the following messages:

  • type: EVAL, payload: any Glyph command

The Glyph Server handles this message by running the Glyph command and once the command completes, responds with one of two messages:

  • type: OK, payload: result of Glyph command
  • type: ERROR, payload: error description

Errors

This action cannot be run through a Glyph Server connection.

Returns

This action returns nothing.

source

pw::Script source filename

This action includes and executes the specified Glyph file with its own undo level.  If the Glyph file is a self-contained script and modifies the undo stack, using this method instead of the standard Tcl source command will contain the undo changes within the script.

Parameters

filenameThis parameter is the name of the Glyph file to include.

Returns

This action returns a boolean, which is true if the script executes successfully.

loadTk

pw::Script loadTk

This action loads and initializes the Tk library for use in the script.

Parameters

none

Returns

This action returns nothing.

pw::Script get/setServerActive active
This attribute is a flag for whether the Glyph Server is actively listening for client connections or not.
pw::Script get/setServerPort port
This attribute is the TCP port number of that the Glyph Server listens on for client connections.
pw::Script get/setServerAuthentication code
This attribute is an authentication code used to authenicate the clients that attempt to connect to the Glyph Server.
pw::Script processServerMessages ?-authentication code? ?-timeout seconds?
This action processes incoming messages to the Glyph Server, which allows executing Glyph commands in Pointwise over a TCP port.
pw::Script source filename
This action includes and executes the specified Glyph file with its own undo level.
pw::Script loadTk
This action loads and initializes the Tk library for use in the script.
Base type for all glyph types
A boolean is represented as a 0 or 1, with 0 being false and 1 being true.
An integer is a whole number.
A string is an array of characters.