User manual
Series 3700 System Switch/Multimeter Reference Manual Section 2: TSP Programming Fundamentals
3700S-901-01 Rev. C / July 2008 2-5
Named scripts
The loadscript message can also be used to create named scripts. Loading
a named script does not replace the anonymous script. Instead, a global
variable in the run-time environment is temporarily created to store the script.
Because the script is stored in a global variable, the name of the script must be
a legal TSL variable name. Specify the name of the script in the loadscript
message by separating it from the loadscript keyword with a space
character.
For example, the message loadscript MyScript will instruct the TSP
TM
-
enabled instrument to begin gathering command messages that will be used to
create a script named MyScript. After sending the command messages, the
endscript message is still used to indicate the end of the script. Upon receipt
of the endscript message, the instrument will compile the script. If there are
no errors, the script will be made available as the global variable MyScript,
because that is the name we used in the loadscript MyScript message.
After a named script has been successfully sent to the instrument, you can run it
at any time by sending either the MyScript() or
script.user.scripts.MyScript() command.
Named script key points:
Create different script names using loadscript.
Sending a new script with the same name will overwrite (replace) the
previous version.
Sending new scripts with different names will not remove previously sent
scripts.
Using named scripts, any number of scripts can be made available
simultaneously within the limits of the memory available to the run-time
environment.
Named scripts are stored as global variables in the run-time environment.
Therefore, like all other global variables, they are lost when the unit is
powered off.
Nonvolatile storage can be used to store downloaded scripts across power
cycles. See Saving a user script (on page 2-22) for more information.