Model 2601B-PULSE System SourceMeter Instrument Reference Manual Section 11: TSP command reference
2601B-PULSE-901-01A April 2020 11-161
script.newautorun()
This function creates a script and enables autorun.
Usage
scriptVar = script.newautorun("code")
scriptVar = script.newautorun("code", "name")
The name of the variable that will reference the script
A string that contains the body of the script
Details
The name parameter is the name that is added to the script.user.scripts table. If name is not
given, an empty string is used, and the script is unnamed. If the name already exists in
script.user.scripts, the existing script's name attribute is set to an empty string before it is
replaced by the new script.
Note that name is the value that is used for the instrument front panel display. If this value is not
defined, the script is not available from the front panel.
You must save the new script into nonvolatile memory to keep it when the instrument is turned off.
The script is run automatically immediately after it is created.
This command is the same as the script.new() function except that the script is automatically run.
Example
NewAuto = script.newautorun("print('Hello from new auto run command')", 'NewAuto')
print(NewAuto.autorun)
print(NewAuto.name)
Creates a new script called NewAuto that automatically has the autorun attribute set to yes after it is created.
The name is set to "NewAuto".
Output:
Hello from new auto run command
yes
NewAuto
Also see
Create a script using the script.new() command (on page 10-37)
Global variables and the script.user.scripts table (on page 10-36)
Named scripts (on page 10-4)
script.new() (on page 11-160)
scriptVar.autorun (on page 11-163)
scriptVar.save() (on page 11-166)