User manual
Section 2: TSP Programming Fundamentals Series 3700 System Switch/Multimeter Reference Manual
2-4 3700S-901-01 Rev. C / July 2008
Scripts
When taking advantage of the TSP
TM
to perform more complicated sequences of
commands, especially sequences utilizing advanced scripting features such as
looping and branching, sending the entire sequence in one message is very
cumbersome. Use the loadscript and endscript messages to collect a
sequence of commands into one chunk.
The loadscript message marks the beginning of a script. The instrument will
collect all following messages until the endscript message is received (the
endscript message marks the end of the script). The TSP-enabled instrument
compiles the test sequence and makes it available to run in a subsequent
message. This chunk is called the "anonymous script."
NOTE Every time the script.run() command is given, the anonymous
script will be executed.
The anonymous script can be run at any time by sending the command
script.run() or script.anonymous(). The anonymous script can be run
many times (it remains in active memory until a new anonymous script is
created). Sending a new script using the loadscript and endscript
messages will instruct the TSP-enabled instrument to replace the anonymous
script with the new script. To see the current contents of the anonymous script,
send the command script.anonymous.list().
Creating and using scripts this way is a very powerful feature of TSP-enabled
instruments, but it is limited to accessing only one script at a time. The solution
to this limitation is to create user-defined named scripts. See Named scripts (on
page 2-5) for information on how to use named scripts, and also how to store
many scripts in the instrument at one time.