Teledyne LeCroy SAS_SATA Tracer_Trainer Automation API Manual User Manual

Page 84

Advertising
background image

LeCroy Corporation

Automation API for SAS/SATATracer/Trainer

Manual Version 1.11

84


VBA: ( MS Excel )

Public SASTracer As SASAnalyzer
Public Trace As SASTrace
Public GVSEngine As VScriptEngine

' VSEngineEventsModule is a special class implementing VSE event handlers.
' It should have, in the global declaration section, the line like this:
' Public WithEvents VSEEvents As VScriptEngine

Dim X As New VSEngineEventsModule

Private Sub RunVScritButton_Click()

Dim VSEngine As VScriptEngine
Dim IVScript As ISASVerificationScript
Dim ScriptName, fileToOpen As String

ScriptName = ThisWorkbook.Sheets("Sheet1").Cells(2, 2)

If SASTracer Is Nothing Then

Set SASTracer = New SASAnalyzer

If SASTracer Is Nothing Then

MsgBox "Unable to connect to SASTracer", vbExclamation
Exit Sub

End If

End If

fileToOpen = ThisWorkbook.Sheets("Sheet1").Cells(1, 2)
Set Trace = SASTracer.OpenFile( fileToOpen )

Set IVScript = Trace ' Get the IfcVerificationScript interface.
Set VSEngine = IVScript.GetVScriptEngine( ScriptName )

' "Subscribe" for receiving VSE events.
' The X variable (an instance of VSEngineEventsModule class) handles them.

Set X.VSEEvents = VSEngine

...

VSEngine.Tag = 12 ' Assign a tag for VSE object.
VSEngine.RunVScript ' Run verification script.

Set X.VSEEvents = Nothing ' "Unsubscribe" for receiving VSE events.
Set VSEngine = Nothing ' Release external
Set IVScript = Nothing ' objects.

End Sub

Advertising