
2606B System SourceMeter® Instrument Reference Manual
Section 6: Instrument programming
2606B-901-01 Rev. B / May 2018
6-43
Example: Retrieve source code one line at a time
test.list()
Retrieve the source of a script named "
test
".
The output will look similar to:
loadscript test
display.clear()
display.settext("This is a test")
print("This is a test")
endscript
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(test.source)
Retrieve the source of a script named
"
test
".
Output might look similar to:
display.clear()
display.settext("This is a
test") print("This is a
test")
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-36) for more information.
Delete user scripts from the instrument
In most circumstances, you can delete a script using
script.delete()
(as described in
(on page 6-11)), and then turn the instrument off and back on again. However, if you
cannot turn the instrument off, you can use the following steps to completely remove a script from the
instrument.
When you completely remove a script, you delete all references to the script from the run-time
environment, the
script.user.scripts
table, and nonvolatile memory.