Introduction

A quick and easy way to start using remote control with your oscilloscope is to create an HTML application. An HTML application is a program that is written in HTML and one or more scripting languages that are supported by Internet Explorer. HTML applications are created with an “.hta” extension. This document is intended as a getting started guide for using an HTML application with ActiveDSO to remotely control a Teledyne LeCroy oscilloscope.

System Requirements

Configuring the oscilloscope for TCPIP communication

To make a connection to an oscilloscope, remote control should be configured for the connection on the oscilloscope. Select Utilities > Utilities Setup from the drop down menu at the top of the oscilloscope’s display. Then select the Remote tab and press the TCPIP (VICP) button. Take note of the IP address of the oscilloscope.

Note: You may use any connection type that your oscilloscope supports with ActiveDSO. This tutorial uses TCPIP since it is the most common. See the ActiveDSO help file for more information on using the MakeConnection method with other connection types.

Example HTML Application

This document details an example HTML Application which is an ActiveDSO GUI that may be used to send commands to an oscilloscope. This example consists of one remote command to change the Channel 1 V/Div setting to 20mV, automation commands to set P1 parameter to risetime and P2 parameter to amplitude, automation commands to query the values of P1 and P2, and an exit button that closes the application. To use this application, or to create a new one, open a notepad, or other text editor, and copy and paste the code into that editor. Then save the application to filename.hta. The full example HTML application is provided in Appendix A.

Create HTML page in the application

The first step in creating an HTML application is to create the page that contains the GUI. This is done in the same basic format as a typical HTML web page. The following example shows start and end tags for HTML, HEAD, and BODY. Inside the HEAD tags, we place the page title, which appears in the title bar of the page. In the body, we place a heading, and below that we place the contents of the page. In this case, in the example html application, we place vbscript to create each button.


<html>
<head>
<title>ActiveDSO example using HTML</title>
</head>
<body>
<h1>ActiveDSO Controls</h1>
<!Page and script content>
</body>
</html>

Connect and interact with the instrument using Remote Control commands

First, a button is created that launches a script that connects to the oscilloscope and changes the Channel 1 V/DIV setting to 20mV. The script creates the ActiveX object, connects to the oscilloscope, and then sends the Remote Control command. A message is then displayed in a message box after the command has been sent.


<! Create Button to change C1 V/Div setting to 20mV>
<INPUT TYPE="Button" NAME="Button1" VALUE="Set C1 V/DIV 20mV">
<SCRIPT FOR="Button1" EVENT="onClick" LANGUAGE="VBScript">
Set o = CreateObject("LeCroy.ActiveDSOCtrl.1") 'Create ActiveX Object
Call o.MakeConnection("IP: 127.0.0.1") 'Connect to the DSO, Substitute your IP Address
Call o.WriteString("C1:VDIV 0.02", TRUE) 'Remote Control Command set VDIV setting to 20mV
MsgBox ("V/Div setting changed") 'Display message in message box
</SCRIPT>

Connect and interact with the instrument using Automation commands

Secondly, a button is created that connects to the oscilloscope and sets the P1 parameter to risetime, and the P2 parameter to amplitude. The script creates the ActiveX object, connects to the oscilloscope, and then sends the automation commands. The automation commands set P1 to risetime and P2 to amplitude, set the source of P1 and P2 to C1, set P1 and P2 to visible, and set measurements to visible. Finally, a message is displayed in a message box after the automation commands have been sent.


<! Create Button to set P1 to Risetime and P2 to Amplitude with Automation Commands>
<INPUT TYPE="Button" NAME="Button2" VALUE="Set P1 to Risetime & P2 to Amplitude">
<SCRIPT FOR="Button2" EVENT="onClick" LANGUAGE="VBScript">
Set o = CreateObject("LeCroy.ActiveDSOCtrl.1") 'Create ActiveX Object
Call o.MakeConnection("IP: 127.0.0.1") ' Connect to the DSO, Substitute your IP Address
Call o.WriteString("vbs 'app.Measure.P1.ParamEngine = ""Rise""'", TRUE) ' Send Automation Command to set P1 to RiseTime
Call o.WriteString("vbs 'app.Measure.P2.ParamEngine = ""AMPL""'", TRUE) ' Send Automation Command to set P2 to Amplitude
Call o.WriteString("vbs 'app.Measure.P1.Source1 = ""C1""'", TRUE) 'Send Automation Command to set Source to C1
Call o.WriteString("vbs 'app.Measure.P2.Source1 = ""C1""'", TRUE) 'Send Automation Command to set Source to C1
Call o.WriteString("vbs 'app.Measure.P1.View = True'", TRUE) ' Send Automation Command Set P1 to visible
Call o.WriteString("vbs 'app.Measure.P2.View = True'", TRUE) ' Send Automation Command Set P2 to visible
Call o.WriteString("vbs 'app.Measure.ShowMeasure = True'", TRUE) ' Send Automation Command Set measurements to visible
MsgBox ("Parameters P1 & P2 Set") 'Display message in message box
</SCRIPT>

Connect and return oscilloscope value using Automation commands

Thirdly, a button is created that connects to the oscilloscope and returns the values of P1 & P2 in a new window. The script creates the ActiveX object, connects to the oscilloscope, sends the automation command to query P1 & P2, assigns the values of P1 and P2 to variables, creates a new window, and then writes the variables to the new window. The script also includes an error handler that will close the window if an error occurs.


<! Create Button to query P1 & P2 with Automation Commands and display result in a new window>
<INPUT TYPE="Button" NAME="Button3" VALUE="Query P1 & P2 (Display in new window)">
<SCRIPT FOR="Button3" EVENT="onClick" LANGUAGE="VBScript">
Set o = CreateObject("LeCroy.ActiveDSOCtrl.1") 'Create ActiveX Object
Call o.MakeConnection("IP: 127.0.0.1") 'Connect to the DSO, Substitute your IP Address
Call o.WriteString("vbs? 'return = app.Measure.Measure(""P1"").Out.Result.Value';WAIT;*OPC", TRUE) ' Send Automation Command to query Parameter P1
var1 = o.ReadString(80) ' Assign query result to variable

Call o.WriteString("vbs? 'return = app.Measure.Measure(""P2"").Out.Result.Value';WAIT;*OPC", TRUE) ' Send Automation Command to query Parameter P2
var2 = o.ReadString(80) ' Assign query result to variable
' Create Parameter Window
Set param = CreateObject("InternetExplorer.Application")
param.Offline = True
param.Navigate "about:blank"
Do While param.Busy : WScript.Sleep 100 : Loop
' Adjust Parameter Window size here
param.Height = 300
param.Width = 300
param.MenuBar = False
param.StatusBar = False
param.AddressBar = False
param.Toolbar = False
param.Visible = True
param.document.write ("P1 :") 'Write header
param.document.write ("<br></br>") 'Carriage Return
param.document.write (var1)'Write variable
param.document.write ("<br></br>") 'Carriage Return
param.document.write ("P2 :") 'Write header
param.document.write ("<br></br>") 'Carriage Return
param.document.write (var2)'Write variable
'Error handler to close Param window on error
If Err <> 0 Then
Param.Quit
End If
</SCRIPT>

Close the HTML GUI and end the script

The final portion of the HTML application creates a button that closes the HTML window, ends the script, and displays “goodbye” in a message window.

<! Create Button to close script>
<INPUT TYPE="Button" NAME="Button4" VALUE="Exit">
<SCRIPT FOR="Button4" EVENT="onClick" LANGUAGE="VBScript">
MsgBox ("Goodbye!") 'Display message in message box
window.parent.close 'Close html window
wscript.Quit 'End the script
</SCRIPT>
</code>
</pre>
<h3 class="tdyblue">Appendix A</h3>
<pre>
<code class="html">
<html>
<head>
<title>ActiveDSO example using HTML Application</title>
</head>
<body>
<h1>ActiveDSO Controls</h1>
<! Create Button to change C1 V/Div setting to 20mV>
<INPUT TYPE="Button" NAME="Button1" VALUE="Set C1 V/DIV 20mV">
<SCRIPT FOR="Button1" EVENT="onClick" LANGUAGE="VBScript">
Set o = CreateObject("LeCroy.ActiveDSOCtrl.1") 'Create ActiveX Object
Call o.MakeConnection("IP: 127.0.0.1") 'Connect to the DSO, Substitute your IP Address
Call o.WriteString("C1:VDIV 0.02", TRUE) 'Remote Control Command set VDIV setting to 20mV
MsgBox ("V/Div setting changed") 'Display message in message box
</SCRIPT>

<! Create Button to set P1 to Risetime and P2 to Amplitude with Automation Commands>
<INPUT TYPE="Button" NAME="Button2" VALUE="Set P1 to Risetime & P2 to Amplitude">
<SCRIPT FOR="Button2" EVENT="onClick" LANGUAGE="VBScript">
Set o = CreateObject("LeCroy.ActiveDSOCtrl.1") 'Create ActiveX Object
Call o.MakeConnection("IP: 127.0.0.1") ' Connect to the DSO, Substitute your IP Address
Call o.WriteString("vbs 'app.Measure.P1.ParamEngine = ""Rise""'", TRUE) ' Send Automation Command to set P1 to RiseTime
Call o.WriteString("vbs 'app.Measure.P2.ParamEngine = ""AMPL""'", TRUE) ' Send Automation Command to set P2 to Amplitude
Call o.WriteString("vbs 'app.Measure.P1.Source1 = ""C1""'", TRUE) 'Send Automation Command to set Source to C1
Call o.WriteString("vbs 'app.Measure.P2.Source1 = ""C1""'", TRUE) 'Send Automation Command to set Source to C1
Call o.WriteString("vbs 'app.Measure.P1.View = True'", TRUE) ' Send Automation Command Set P1 to visible
Call o.WriteString("vbs 'app.Measure.P2.View = True'", TRUE) ' Send Automation Command Set P2 to visible
Call o.WriteString("vbs 'app.Measure.ShowMeasure = True'", TRUE) ' Send Automation Command Set measurements to visible
MsgBox ("Parameters P1 & P2 Set") 'Display message in message box
</SCRIPT>

 

<! Create Button to query P1 & P2 with Automation Commands and display result in a new window>
<INPUT TYPE="Button" NAME="Button3" VALUE="Query P1 & P2 (Display in new window)">
<SCRIPT FOR="Button3" EVENT="onClick" LANGUAGE="VBScript">
Set o = CreateObject("LeCroy.ActiveDSOCtrl.1") 'Create ActiveX Object
Call o.MakeConnection("IP: 127.0.0.1") 'Connect to the DSO, Substitute your IP Address
Call o.WriteString("vbs? 'return = app.Measure.Measure(""P1"").Out.Result.Value';WAIT;*OPC", TRUE) ' Send Automation Command to query Parameter P1
var1 = o.ReadString(80) ' Assign query result to variable
Call o.WriteString("vbs? 'return = app.Measure.Measure(""P2"").Out.Result.Value';WAIT;*OPC", TRUE) ' Send Automation Command to query Parameter P2
var2 = o.ReadString(80) ' Assign query result to variable
' Create Parameter Window
Set param = CreateObject("InternetExplorer.Application")
param.Offline = True
param.Navigate "about:blank"
Do While param.Busy : WScript.Sleep 100 : Loop
' Adjust Parameter Window size here
param.Height = 300
param.Width = 300
param.MenuBar = False
param.StatusBar = False
param.AddressBar = False
param.Toolbar = False
param.Visible = True
param.document.write ("P1 :") 'Write header
param.document.write ("<br></br>") 'Carriage Return
param.document.write (var1)'Write variable
param.document.write ("<br></br>") 'Carriage Return
param.document.write ("P2 :") 'Write header
param.document.write ("<br></br>") 'Carriage Return
param.document.write (var2)'Write variable
'Error handler to close Param window on error
If Err <> 0 Then
Param.Quit
End If
</SCRIPT>

<BR> <!Carriage Return>
<BR> <!Carriage Return>
<BR> <!Carriage Return>
<! Create Button to close script>
<INPUT TYPE="Button" NAME="Button4" VALUE="Exit">
<SCRIPT FOR="Button4" EVENT="onClick" LANGUAGE="VBScript">
MsgBox ("Goodbye!") 'Display message in message box
window.parent.close 'Close html window
wscript.Quit 'End the script
</SCRIPT>
</body>
</html>