EasyManua.ls Logo

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

Newport XPS-Q8
66 pages
To Next Page IconTo Next Page
To Next Page IconTo Next Page
To Previous Page IconTo Previous Page
To Previous Page IconTo Previous Page
Loading...
XPS-Q8 Tcl Manual
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 [ open "/dev/$tcl_argv(0)" r+]
} 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:
EDH0307En1041 — 10/17
17

Table of Contents

Other manuals for Newport XPS-Q8

Related product manuals