You can use the result of one command as an argument to another command. This is called command substitution:
For Local
variables (i.e. variable used inside
scripts) examples are:
set a
2
set b [expr
$a*16]
s
et
deltat [expr $time2 - $time1]
In the above a and
b are not a tags. They are local variables used inside a
script.
For Tags
(i.e. IO Tags,
Bock:parameters, constant Tags, Calculation Tags, Accumulation
Tags, System Tags, local tags and %DAQ tags) examples
are:
SETVAL tag1=@
tag2
SETVAL
tag1={GETVAL tag2}
SETVAL
tag1=[GETVAL tag2]
SETVAL anatag1=[expr [GETVAL anatag2] * 10]
SETVAL
tag2=[expr [GETVAL tag1]+[GETVAL tag2] ]
set deltat [expr [GETVAL tag1]+[GETVAL tag2] ]
In the above example, Tag1, tag2, anatag1, anatag2 are all Tags. deltat is a local variable.
When a square bracket [
appears in a
command, Tcl treats everything between it and the matching end
bracket ]
as a single command.
Tcl evaluates the nested command and substitutes its result into
the enclosing command in place of the bracketed text.
Quotes " " also force command substitution.
See 12.3.3.1 Braces or Quotes or Brackets