beautypg.com

Teledyne LeCroy WaveExpert series Automation Manual User Manual

Page 18

background image

A

BOUT

A

UTOMATION

1-6

916435 RevA

The

app.Display.GridMode = "Quad"

statement.


app.Display.GridMode = “Quad”

Using the app handle, this line of code sets the GridMode control of the Display system to the value

“Quad”. It’s important to note that the controls are arranged in a hierarchy, with each ‘level’ of the

hierarchy delimited with a decimal point ( . ).

The

myVerScale = app.Acquisition.C1.VerScale

statement.


myVerScale = app.Acquisition.C1.VerScale

Instead of setting the value of a control, this line of code retrieves the current value of a control, in this

case the Vertical Scale (Volts/Div) of Channel 1. The value returned is stored within the variable
myVerScale

.

N

N

O

O

T

T

E

E

:

:

In Visual Basic Script it is not necessary to

“Dimension” variables before using them (for example,
using statements like “Dim myVerScale as Double”).

The

MsgBox

myVerScale statement


MsgBox myVerScale

This line of code does not communicate with the scope at all, but calls the standard Visual Basic Script

function MsgBox. This function displays a dialog containing the value of the variable following “MsgBox”.

In our case the value of Channel 1’s vertical scale, and waits for the OK button to be clicked.

Documentation about the MsgBox function can be found in Microsoft’s Visual Basic Scripting

documentation at www.microsoft.com\scripting.

Another point that should be mentioned here is something that is used extensively in Setup files created by the

instrument: the ability to use “abbreviations” to simplify programs. Following is an example in which a shorthand

method is used to replace some rather long-winded code. It is also important to note that this also enhances

performance. For example, the “lookup” of the object app.Acquisition.C1 occurs only once in the modified

code, but three times in the original code.
Instead of:

app.Acquisition.C1.VerScale = 0.5
app.Acquisition.C1.VerOffset = 0.1
app.Acquisition.C1.Coupling = "DC50"

The following may be used:

set myChannel1 = app.Acquisition.C1
myChannel1.VerScale = 0.5
myChannel1.VerOffset = 0.1
myChannel1.Coupling =

"

DC50

"