Series 2600B System SourceMeter® Instrument Reference Manual
Section 6: Instrument programming
2600BS-901-01 Rev. B / May 2013
6-45
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")
Delete user scripts from the instrument
In most circumstances, you can delete a script using
script.delete()
(as described in
Delete
user scripts
(on page 6-9)), 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.
To completely remove a script:
1.
Remove the script from the run-time environment.
Set any variables that refer to the script to
nil
or assign the variables a different value. For example, to remove the script
"beepTwoSec"
from the run-time environment, send the following code:
beepTwoSec = nil
2.
Remove the script from the script.user.scripts table.
Set the name attribute to an empty
string (
""
). This makes the script nameless, but does not make the script become the anonymous
script. For example, to remove the script named
"beepTwoSec"
, send the following code:
script.user.scripts.beepTwoSec.name = ""
3.
Remove the script from nonvolatile memory.
To delete the script from nonvolatile memory,
send the command:
script.delete("
name
")
Where
name
is the name that the script was saved as. For example, to delete
"beepTwoSec"
,
you would send:
script.delete("beepTwoSec")
Summary of Contents for System SourceMeter 2601B
Page 841: ......