Hello World !" Example; Tcl Script Example; Tcl Script Execution - Newport XPS-Q8 Manual

Universal high-performance motion controller/driver
Table of Contents

Advertisement

XPS-Q8
4.2

"Hello world !" Example

4.2.1

Tcl script example

The following Tcl script example shows how to display a message in a telnet window.
# Set channel's name to be used for telnet.
# In this example we assume it is passed to the script as the
# first argument, if not specified output to stdio.
# Open the channel for read mode and get its id,
# this is the id that will be passed to puts function.
if
{$tcl_argv(0) != 0} {
set
telnetOut [
} else {
set
telnetOut stdout
}
# display hello world message
puts
$telnetOut "Hello world !"
# Force transfer to channel's output buffer
flush
$telnetOut
4.2.2

Tcl script execution

When you open a telnet session you can see the channel's identifier as shown below:
The channel identifier will be used as argument for the function called from Terminal to
execute the Tcl script:
open
"/dev/$tcl_argv(0)" r+]
17
Tcl Manual
EDH0307En1041 — 10/17

Hide quick links:

Advertisement

Table of Contents
loading

Table of Contents