There are three types of Tcl commands:
Built-in commands are provided by the Tcl interpreter. They are available in all Tcl applications. Here are some examples of built-in Tcl commands:
Tcl provides several commands for manipulating file names, reading and writing file attributes, copying files, deleting files, creating directories, and so on.
exec - run an external program. Its return value is the output (on stdout) from the program, for example:
set tmp [ exec myprog ]
puts stdout $tmp
You can easily create collections of values (lists) and manipulate them in a variety of ways.
You can create arrays - structured values consisting of name-value pairs with arbitrary string values for the names and values.
You can manipulate the time and date variables.
You can write scripts that can wait for certain events to occur, such as an elapsed time or the availability of input data on a network socket.
You use the proc command to declare a procedure. You can then use the name of the procedure as a Tcl command.
The following sample script consists of a single command named proc. The proc command takes three arguments:
The name of a procedure (myproc)
A list of argument names (arg1 arg2)
The body of the procedure, which is a Tcl script
proc myproc { arg1 arg2 } {
# procedure body
}
myproc a b
Many functions that you can perform through the Designer software's GUI interface, you can also perform using an equivalent Tcl command. For example, the backannotate command is equivalent to executing the Back-Annotate command from Designer's Tools menu. For a list of Tcl commands supported in the Designer software, see the topics under Tcl Commands.