49.1.9.3 Node Exec Button

In nam releases, version 1.0a10 and later there is support for running external userdefinable scripts or programs from nam by clicking on a node button.

v -t 1.0 -e node_tclscript node_id button label tcl script

This line when read in a tracefile will add an extra button to node objects that will execute a tcl script when clicked.

For example:
v -t 1.0 -e node_tclscript 2 "Echo Hello" {puts [exec echo hello]}

The above line adds a button to node 2's info window with the label "Echo Hello" and when this button is pressed the shell command "echo hello" will be run and it's output will be returned to nam and then output to the terminal via the tcl procedure puts.

The functions that implement the different nam trace formats described above may be found in the following files: ns/trace.cc, ns/trace.h, ns/tcl/lib/ns-namsupp.tcl.



Tom Henderson 2011-11-05