User manual

Section 2: TSP Programming Fundamentals Series 3700 System Switch/Multimeter Reference Manual
2-22 3700S-901-01 Rev. C / July 2008
Get or change the name attribute of a script
The following commands are used to get or change the name attribute of a
script:
val = myscript.name -- read the name of myscript
myscript.name = val -- change the name of myscript
Where:
myscript is the script
val is the name of the script
This attribute may optionally be initialized when the script is created. See
Loading a user script (on page 2-24) (script.load) and Creating a user script
(alternative) (on page 2-21) (script.new) for details.
This attribute must be either a valid Lua identifier or the empty string. Changes
to its value are reflected in the script.user.scripts table. Setting the
attribute to the empty string will remove the script from the table completely.
For example, a new script can be created without naming it, such as:
MyTest7 = script.new("display.clear()
display.settext('Hello from my test')")
To run this script, type:
MyTest7()
If print(MyTest7.name) is executed, it will print a blank line because the
name is an empty string.
To name the script "MyTest7" and read the name, send:
MyTest7.name = 'MyTest7'
print(MyTest7.name) --> MyTest7 is displayed
Saving a user script
A created and loaded script does not have to be saved in the nonvolatile
memory of the Series 3700 before it can be run. However, an unsaved script will
be lost when the Series 3700 is turned off.