Section 6: Instrument programming
Models 707B and 708B Switching Matrix Reference Manual
6-38
707B-901-01 Rev. A / August 2010
Create a script using the script.new command
Use
script.new
to copy an existing script from the local node to a remote node. This can enable
parallel script execution.
You can create a script with the
script.new()
function using the command:
scriptVar = script.new(code, name)
Where:
•
scriptVar
is the name of the variable that is created when the script is loaded into the runtime
environment.
•
code
is the content of the script
•
name
is the name that is added to the
script.user.scripts
table
For example, to set up a two-second beep, you could send the command:
beepTwoSec = script.new("beeper.enable = 1 beeper.beep(2, 2400)", "beepTwoSec")
To run the new script, you can send the command:
beepTwoSec()
When you add
beepTwoSec
, the global variable and
script.user.script
table entries are made
to the runtime environment as shown in the following figure.
Figure 81: Runtime environment after creating a script
name
value
script.user.scripts table
beepTwoSec
pointer to script named
beepTwoSec
Global variables
Scripts in the runtime environment
beepTwoSec
pointer to script named
beepTwoSec
No
Autorun
beeper.enable = 1
beeper.beep(2, 2400)
script name
source
beepTwoSec