
SR1 Operation Manual
246
© 2014 Stanford Research Systems
set chna = SR1.AnlgGen.AGenChA
chna.Gain("db")= -10.0
x = chna.FreqRdg("")
Actions
Actions are functions associated with objects which can return values and take parameters. Parameters
are shown underneath the associated action with the
icon. Return values from actions are denoted by the
icon. Integer parameters, like properties, may
have enumerations which are listed underneath the parameter. The syntax for using actions in scripts is
similar to that for properties. For instance, the action "LoadTrace" associated with a graph takes a string
specifying a trace file and returns an integer which is the id of the new trace. In a script:
intMyTraceId = SR1.Graph(graphId).LoadTrace("C:\myTraceFile.xml")
One peculiarity of the syntax is the necessity to use the keyword "Call" for actions that have no return
values or when the return value is not assigned to a variable. So the example above, if one were not
interested in the new trace ID, would be modified to :
Call SR1.Graph(graphId).LoadTrace("C:\myTraceFile.xml")
The same syntax applies to actions with no return value:
Call SR1.Displays.Graph(graphId).AutoScaleX()
Input and Output with Scripts
SR1 scripts can interact with the user in a variety of ways. The built-in VBscript function MsgBox
displays a message window containing a user specified string and an "OK" button. For instance, the
line:
MsgBox("MsgBox Argument")
produces the following output:
The message window remains up until the user presses either the "OK" button or the "Close Window"
button. The "Instrument" section of the SR1 Basic Interface contains several other functions designed to
provide flexible input/output from scripts.
UserMessage
The UserMessage function is similar to the built-in MsgBox function except that it contains an additional
parameter which specifies a time-out period in seconds. If the user does not press the "OK" or "Close
Window" boxes within the time out period the window will disappear and the function returns -1. If the
user does take action within the time-out period the function returns 1.For instance:
dim x
x = SR1.Instrument.UserMessage("User Message",5)
if x = -1 then
Содержание SR1
Страница 5: ...Part I Getting Started Audio...
Страница 7: ...Getting Started 7 2014 Stanford Research Systems...
Страница 12: ...SR1 Operation Manual 12 2014 Stanford Research Systems...
Страница 27: ...Part II SR1 Operation Audio...
Страница 156: ...SR1 Operation Manual 156 2014 Stanford Research Systems Passband Group Delay of Elliptical Filter...
Страница 258: ...SR1 Operation Manual 258 2014 Stanford Research Systems...
Страница 272: ...SR1 Operation Manual 272 2014 Stanford Research Systems on the amplitude sweep...
Страница 289: ...SR1 Operation 289 2014 Stanford Research Systems...
Страница 290: ...Part III SR1 Reference Audio...