Section 10: Instrument programming
Series 3700A System Switch/Multimeter Reference Manual
10-44
3700AS-901-01 Rev. D/June 2018
Advanced scripting for TSP
The following topics describe advanced information that can help you understand how the Test Script
Processor (TSP
®
) scripting engine works.
Global variables and the script.user.scripts table
When working with script commands, it is helpful to understand how scripts are handled in the
instrument.
Scripts are loaded into the run-time environment from nonvolatile memory when you turn the
instrument on. They are also added to the run-time environment when you load them into the
instrument.
A script in the run-time environment can be:
•
A named script
•
An unnamed script
•
The anonymous script (which is a special unnamed script)
Script names can be assigned by using the loadscript command or by defining the scriptVar
parameter of the
script.new()
function. When a named script is loaded into the run-time
environment:
•
A global variable with the same name is created so that you can reference the script more
conveniently.
•
An entry for the script is added to the
script.user.scripts
table.
When you create a script using the
script.new()
function without providing a name, the script is
added to the run-time environment as an unnamed script. The
script.new()
function returns the
script, but the script is not added to the
script.user.scripts
table.
When the anonymous script is loaded, it does not have a global variable or an entry in the
script.user.scripts
table. If there is an existing anonymous script, it is replaced by the new
one.
When the instrument is turned off, everything in the run-time environment is deleted, including the
scripts and global variables.
See the figure below to see how the scripts, global variables, and
script.user.scripts
table
interrelate.