Overview – Teledyne LeCroy WaveExpert series Automation Manual User Manual
Page 17
![background image](/manuals/353447/17/background.png)
C
HAPTER
O
NE
Overview
916435 RevA
1-5
STEP-BY-STEP AUTOMATION INTRODUCTIONS USING
VBScript
This section of the manual presents a walk-through of how to create a simple remote control application, which
will run on the instrument, from scratch. It doesn’t rely upon any 3
rd
-party development tools, since it uses
Windows’ built-in text editor (Notepad) and the Visual Basic Script interpreter (VBScript), which is also installed on
all instruments.
1. Use
the
File
→Windowed
menu option to place the DSO application into windowed mode. This allows the
windows start-bar to be accessed.
2. Open
Windows
Notepad
via Start->Programs->Accessories->Notepad
a. Write the following text into the editor:
Set app = CreateObject("LeCroy.XStreamDSO")
app.AutoSetup
app.Display.GridMode = "Quad"
myVerScale = app.Acquisition.C1.VerScale
MsgBox myVerScale
3. Save the file to drive D:\ and name it Exercise1.vbs. Leave Notepad open, we’ll need it again.
4. Open Windows Explorer, via Start→Programs→Accessories→Windows Explorer.
5. Navigate to drive D:\ and double-click on Exercise1.vbs.
6. That’s it. If these steps were followed correctly, you should hear relays clicking while the scope performs
an auto-setup operation and enters its quad-grid display mode.
So, what did this “program” actually do?
•
The
CreateObject
statement.
Set app = CreateObject("LeCroy.XStreamDSO")
CreateObject is the Visual Basic function that creates an instance of a COM Server (a.k.a. ActiveX
Control). The argument “LeCroy.XStreamDSO” refers to our DSO application. Once it has instantiated
(connected to) our DSO application we need some kind of ‘handle’ (pointer) to it so that we can use it
later to communicate with the instrument. CreateObject returns a handle to us, which we store in the app
variable.
N
N
O
O
T
T
E
E
:
: Only a single instance of the X-Stream DSO software
can run on a system at one time. If the DSO software is
already running when CreateObject is called, a handle to
that running instance is returned. If the DSO software is not
running, it will be started.
•
The
app.AutoSetup
statement.
app.AutoSetup
Using the app handle, this line of code calls the AutoSetup method, which performs the same task as
the front-panel Auto-Setup button. Documentation for this method can be found later in the reference
section.