Model 2601B-PULSE System SourceMeter Instrument Reference Manual Section 10: Instrument programming
2601B-PULSE-901-01A April 2020 10-5
Figure 129: Loadscript and endscript example
To load a named script by sending commands:
1. Send the command loadscript scriptName, where scriptName is the name of the script.
The name must be a legal Lua variable name.
2. Send the commands that need to be included in the script.
3. Send the command endscript.
4. You can now run the script. See Run scripts (on page 10-7).
To run the script immediately, use loadandrunscript scriptName instead of loadscript.
Load a script from the instrument front panel
You can also load scripts from a USB flash drive to the runtime environment of the instrument.
Depending on the content of the TSP file on the drive, the script can be loaded either as an
anonymous script without a designated name, or as a named script with a user-defined name. Only
named scripts can be saved to internal nonvolatile memory. Only one anonymous script can exist in
the runtime environment.
To load a script into the instrument with a specific name, the TSP file must include the shell keywords
loadscript and endscript, along with the specified script name, as shown in the example file
MyScript1.tsp, which contains the script:
loadscript Beeper
reset()
beeper.enable = beeper.ON
beeper.beep(2, 2400)
endscript