About Macros
Macros let you automate a series of manual operations into a single command. Uses for macros include automation of repetitive tasks and computation of measurement results that are beyond the scope of the 89600 VSA.
The 89600 VSA supports generating and editing macros that are written in the C# and VB.NET programming languages. Unlike the version 12 and older of the VSA, where macros were written in VBScript and were not able to be run separate from the 89600 VSA, macros from VSA version 13 and newer are encapsulated in a standalone Visual Studio solution. They are only macros in the sense that they follow a certain structure and reside in the %USERPROFILE%\My Documents\Keysight\89600B VSA\Macros directory.
A macro can be run in the 89600 VSA process or can be run as an external process. To run a macro in the VSA process, the VSA must invoke the macro. This can be done by pressing the Run button on the Macros Dialog or by calling the Run() method on a macro in the Application.Macros collection.
The advantage of running a macro in the VSA's process is that, instead of method calls and access to data having to use full inter-process .NET remoting, access to the API 1) Access Preamble Indicator, or 2) Application Programming Interface only has to use .NET remoting to cross an AppDomain boundary within the VSA process, resulting in faster access to the VSA's .NET API.
When a macro is run as a separate process (i.e. when run from within Visual Studio), the macro must create a .NET remoting connection to the VSA process using the ApplicationFactory.Create() method. This way of automating the VSA is not as fast as running a macro in process, but running as an external process provides some advantages such as being able use the Visual Studio debugger.
You can run a macro from within another macro, but attempting to call the Run() method on a currently-running macro will fail.
The only supported programming languages for macros are VB.NET and C#. However, any programming language that can access the .NET Common Language Runtime (CLR) can access the 89600 VSA .NET API. To learn about programming using the .NET API and other program languages including VB.NET, C#, C++, and MATLAB, see the 89600 VSA .NET API Reference.
What can macros be used for?
- One-button applications
- Automation of repetitive tasks
- Computation of measurement results that are beyond the scope of the 89600 VSA
- A tool for learning how to programmatically control the VSA
Where can you find a list of example programs?
The 89600 VSA provides several example programs to demonstrate how to make measurements and query data. The VSA also provides some macros to automate various tasks.
Example programs are located in the following directory:
%PROGRAMFILES%\Keysight\89600 Software <ReleaseVersion>\89600 VSA Software\Examples
Example macros are in a Macros directory located within the Examples directory. You can import these macros using the Import button on the dialog.
Documentation for the Example programs is provided in the 89600 VSA .NET API Reference.
See Also