Viz Trio User Guide

Version 3.2 | Published June 29, 2021 ©

Macro Commands over a Socket Connection

Viz Trio can be controlled using custom made control applications over a TCP/IP socket connection on port 6200 (the port number can be overridden - see Command Line Parameters), allowing you to use macro commands to trigger actions.

This section contains information on the following topics:

Sending Macro Commands

Establish a connection with Viz Trio over a socket connection to send Macro Commands to control Viz Trio. The following procedures use Telnet as an example.

Configuring Viz Trio for Socket Connections

  1. Open the Configuration Window and select Socket Object Settings.

  2. In the appearing pane set the following:

    • Set Socket type to Server socket.

    • Set Text encoding to UTF-8.

    • Check Autoconnect and set Socket Host to localhost and Socket Port to 6200.

  3. Click OK.

Connecting to Viz Trio Using Telnet

  1. Open Telnet by clicking the Start button, typing Telnet in the Search box, and then clicking OK.

  2. Type telnet localhost 6200 and press ENTER.

    Note: Windows 7 users must enable Telnet as it's disabled by default.

Sending Commands to Viz Trio Using Telnet

  1. Create a page in Viz Trio with the page number 1000.

  2. Open a telnet connection to Viz Trio, type page:read 1000 and press Enter.

Enabling Telnet for Windows 7

  1. Click the Start button, click Control Panel, click Programs, and then click Turn Windows features on or off. If you are prompted for an administrator password or confirmation, type the password or provide confirmation.

  2. In the Windows Features dialog box, select the Telnet Client check box.

  3. Click OK. The installation may take several minutes.

Unicode Support

Commands that can set and get text values (such as set_value and getproperty) supports the full set of Unicode characters. The internal format is UTF-16 (WideString). However, when communicating with Viz Trio over a socket connection on port 6200, an 8-bit string must be used, and the default (and preferred) encoding is therefore UTF-8. It's also possible to use latin1 (ISO-8859-1, western european) encoding.

Toggling the Socket Encoding

  • To toggle the socket encoding, send one of the following commands to the socket: socket_encoding latin1 or socket_encoding utf8.

    Note: The socket_encoding command is not a macro command, and can only be used with socket communication.

Escape Sequences

A socket command is terminated by a new line. To support setting and getting multi-line parameters and results, some characters have to be escaped; that is, represented by sequences of other characters. Backslash is used as the escape character for socket commands.

See the table below for supported escape sequences.

Escape Sequences

Escape Sequence

Meaning

\n

New line

\r

Carriage return

\xHH

Two-digit hexadecimal character code.

\

Backslash (\)

Error Messages

When controlling Viz Trio over a socket connection you can enable error messages using the commandserver command.

commandserver:enable_error_messages true commandserver:enable_error_messages false

Note: Typing commandserver is optional

Enabling error messages sends error messages to the connected client as well as being displayed in the GUI (on a per socket connection). The client receives all error messages that are normally just displayed in the Viz Trio user interface.

Note that not only the error messages generated by the client are sent - all errors will be sent. For example an operator using Viz Trio at the same time and tries to read a non-existing page results in error messages being sent to all clients connected over a socket connection.

Errors have this format:

ERROR: <Error message>

If error handling is turned off, the client will still get errors caused by commands not being found and commands that return an error. This command is only implemented for the command server on port 6200, and is not related to the Socket Object Settings in the Configuration Window.