VB Script: Using Form

Other topics about Sample Application Program

Overview

HTML Applications (HTAs)  allows you to use a form with VB script.

This sample program demonstrates the following operation.

To use this sample:

  1. Copy the following code into a Notepad file.

  2. Save the file on the analyzer storage in the D: folder. Name the file as "form.hta".

  3. Double-click the file to execute.

Sample Program

<html><head>

<title>HTA Sample</title>

<script language="VBScript">

  set ena = CreateObject("E5070.Application")

  ena.scpi.system.preset

  ena.scpi.initiate(1).continuous = false

  Sub Window_OnLoad

    Window.ResizeTo 500,200

  End Sub

  Sub max()

    ena.scpi.calculate(1).selected.marker(1).state = true

    ena.scpi.calculate(1).selected.marker(1).function.type="maximum"

    ena.scpi.calculate(1).selected.MARKer(1).FUNCtion.EXECute

    axisx = ena.scpi.calculate(1).selected.marker(1).x

    axisy = ena.scpi.calculate(1).selected.marker(1).y

    DataArea1.InnerHTML = cstr(axisx)

    DataArea2.InnerHTML = cstr(axisy(0))

  End Sub

  Sub min()

    ena.scpi.calculate(1).selected.marker(2).state = true

    ena.scpi.calculate(1).selected.marker(2).function.type="minimum"

    ena.scpi.calculate(1).selected.MARKer(2).FUNCtion.EXECute

    axisx = ena.scpi.calculate(1).selected.marker(2).x

    axisy = ena.scpi.calculate(1).selected.marker(2).y

    DataArea1.InnerHTML = cstr(axisx)

    DataArea2.InnerHTML = cstr(axisy(0))

  End Sub

</script>

</head>

<body>

<form name="form1" style="font-size:24pt">

<input type="button" value="Marker 1 => Max" onClick="max()" />

<input type="button" value="Marker 2 => Min" onClick="min()" />

<p>

X: <span id = "DataArea1"></span><br>

Y: <span id = "DataArea2"></span>

</p>

</form>

</body>

</html>