Add/Remove Macros
To add, remove, or update a macro in the Macros Menu, simply add, remove, or edit the *.xmacro file in the specified folder within XF's Application Preferences.The Macros Menu links to the following default location:
- Windows: %USERPROFILE%\Documents\Remcom\XFdtd\scripts\menu\macros
- Linux: $HOME/Remcom/XFdtd/scripts/menu/macros
Users can change this location in Application Preferences by working under the General tab and entering a different selection in the Macros Menu portion of the window.
Header Format
By default, the listings in the Macros menu will use the *.xmacro file name, which can be changed by adding a header to the macro file. The header format consists of zero or more comment lines with keywords:value pairs as documented below.The Name:, Icon:, Created:, Version:, Author:, Modified:, Last Modified:, and Description: designations are optional. The Modified: keyword can be specified more than once, whereas other keywords will derive value from the most recent of multiple entries. Authors: is recognized as a synonym for Author:. The designated icon file typically exists in the same folder as the macro, but can also be defined using a relative or absolute path.
Submenus can also be given names, icons, and descriptions by placing the information in a file named menu.desc in the submenu folder using the format described above.
Selecting the Macro Information item at the bottom of each menu opens a dialog that shows the header information. Giving each of the menu's macros a good description is useful because it serves as the help text for that individual macro.
An example of useful annotation can be seen below:
// Icon: Marker.ico
// Created: Oct 1, 2016
// Version: 1.3
// Author: J. Doe
// Modified: Jan 22, 2017 by G. Buck
// Last Modified: Feb 3, 2017 by T. Who
// Description:
// Set the bounds of an existing S-parameters graph to specific
// values, add markers at a set of specified frequencies, and add
// markers at specific dB down levels. If more than one
// S-parameters graph exists, the user will be prompted to select
// the one to modify. The specific values for the bounds and markers
// are customizable in the first section of the macro file.
Limitations
Any output text or error messages produced by the macro will appear in the lower pane of the Scripting window.
Other limitations include the following:
- Only macro scripts (*.xmacro), not functions (*.xfunc), are currently supported.
- Macros menu macros are not directly editable in-place within the application. They need to be imported, edited, and then exported.
- Fully debugging macros before use in the Macros menu is strongly recommended. The previously listed limitation causes difficulty in debugging, and it is therefore suggested that the macro be developed and tested in an XF project and then exported once it is stable.
// Icon: {name of .ico file}
// Created: {date}
// Version: {string}
// Author: {name}
// Modified: {date and author}
// Last Modified: {date and author}
// Description:
// {first line of description}
// {next line of description}
// ...
// {last description line}