Section 6: Instrument programming Model 2657A High Power System SourceMeter® Instrument Reference Manual
6-40 2657A-901-01 Rev. B/December 2012
For example, to set up a two-second beep, you can send the command:
beepTwoSec = script.new("beeper.enable = 1 beeper.beep(2, 2400)", "beepTwoSec")
To run the new script, send the command:
beepTwoSec()
When you add beepTwoSec, the global variable and script.user.scripts table entries are
made to the run-time environment as shown in the following figure.
Figure 96: Runtime environment after creating a script
Create an unnamed script using script.new()
Unnamed scripts are not available from the front-panel display of the instrument. Only the anonymous
script and named scripts are available from the front-panel display.
When you create a script using script.new(), if you do not include name, the script is added to the
run-time environment as an unnamed script. The script.new() function returns the script. You can
assign it to a global variable, a local variable, or ignore the return value. A global variable is not
automatically created.
For example, send the following command:
hello = script.new('display.clear() display.settext("hello")')
A script is created in the run-time environment and a global variable is created that references the
script.
To run the script, send the command:
hello()
Name
Value
script.user.scripts table
beepTwoSec
reference to script
named beepTwoSec
Global variables
Scripts in the run-time environment
beepTwoSec
reference to script
named beepTwoSec
Noautorun
beeper.enable = 1
beeper.beep(2, 2400)
script name
source
beepTwoSec
NOTE