Section 7: Command reference
Models 707B and 708B Switching Matrix Reference Manual
7-160
707B-901-01 Rev. A / August 2010
Example
script.delete("test8")
Deletes a user script named "
test8
" from
nonvolatile memory.
Also see
Delete user scripts from the instrument
(on page 7-166)
script.new()
This function creates a script.
Type
TSP-Link accessible
Affected by
Where saved
Default value
Function No
Usage
scriptVar = script.new(code)
scriptVar = script.new(code, name)
scriptVar
The name of the variable that will reference the script
code
A string containing the body of the script
name
The name of the script
Details
The
name
attribute is the name that is added to the
script.user.scripts
table. If
name
is not given, an
empty string will be used, and the script will be unnamed. If the name already exists in
script.user.scripts
,
the
name
attribute of the existing script is set to an empty string before it is replaced by the new script. Also, if a
name is not given, an empty string is used for the name.
Note that
name
is the value that is used for the instrument front panel display. If this value is not defined, the
script will not be available from the instrument front panel.
You must save the new script into nonvolatile memory to keep it when the instrument is turned off.
Example 1: Create new script
myTest8 = script.new(
"display.clear() display.settext('Hello from myTest8')", 'myTest8')
myTest8()
Creates a new script referenced by the variable
myTest8
with the name "
myTest8"
.
Runs the script. The instrument displays "
Hello from myTest8
."