Model 2651A High Power System SourceMeter® Instrument Reference Manual
Section 6: Instrument programming
2651A-901-01 Rev. A / March 2011
6-7
Autorun scripts
Autorun scripts run automatically when the instrument is turned on. You can set any number of scripts
to autorun. The run order for autorun scripts is arbitrary, so make sure the run order is not important.
As shown in the example below, you can set a script to run automatically by settings the script's
.autorun
attribute to
"yes"
and then saving the script.
Example:
scriptVar
.autorun = "yes"
scriptVar
.save()
Where:
scriptVar
is the user-defined name of the script.
To disable autorun, set the script's
.autorun
attribute to
"no"
and then save the script.
NOTE
The
scriptVar
.save()
command saves the script to nonvolatile memory, which makes the
change persistent through a power cycle. See
Save a user script to nonvolatile memory
(on page 6-
11) for more detail.
Example: Set a script to run automatically
test5.autorun = "yes"
test5.save()
Assume a script named "test5" is in the
runtime environment.
The next time the instrument is turned on,
"test5" script automatically loads and
runs.
Autoexec script
The autoexec script runs automatically when the instrument is turned on. It runs after all the scripts
have loaded and any scripts marked as autorun have run.
To create a script that executes automatically, create and load a new script and name it
autoexec
.
See
NOTE
You need to save the autoexec script to nonvolatile memory to save the script when the instrument is
turned off. See
Save a user script to nonvolatile memory
(on page 6-11) for more detail.
Example: Autoexec script with loadscript command
loadscript autoexec
display.clear()
display.settext('Hello from autoexec')
endscript
autoexec.save()
Creates the script autoexec.
Saves the autoexec script to nonvolatile
memory. The next time the instrument is
turned on, "Hello from autoexec" is
displayed.