Model 2651A High Power System SourceMeter® Instrument Reference Manual
Section 6: Instrument programming
2651A-901-01 Rev. A / March 2011
6-9
NOTE
To retrieve the commands in the anonymous script, use
script.anonymous.list()
.
Example: Retrieve source code one line at a time
test7.list()
Retrieve the source of a script named
"test7".
Retrieve a script as a single string
To retrieve the entire user script source code as a single string, use the
scriptVar.
source
attribute. The
loadscript
or
loadandrunscript
and
endscript
keywords are not included.
To retrieve the source code as a single string, send the command:
print(
scriptVar
.source)
Where
scriptVar
is the name of the script.
Example: Retrieve the source code as a single string
print(test1.source)
Retrieve the source of a script named
"test1".
Retrieve a script using TSB Embedded
In TSB Embedded, from the User Scripts list, select the script you want to retrieve. The contents of
the script are displayed. See
(on page 6-37) for more information.
Script example: Retrieve the content of scripts
This set of examples:
•
Retrieves the source of a script using
scriptVar
.source
•
Retrieves the source of a script using
scriptVar
.list()
Example: Retrieve the content of a script with scriptVar.source
print(scriptVarTest.source)
Request a listing of the source of
scriptVarTest
. The instrument outputs the
following (note that the loadscript and endscript
commands are not included).
Output:
listTones = {100, 400, 800}
for index in listTones do
beeper.beep(.5, listTones[index])
end