# 15.2. Macros¶

VisIt’s Command window contains controls that allow you to record most GUI actions and view Python scripting code needed to accomplish those actions. The Command window provides 8 conventional tabs that serve as destinations for recorded Python coding. In addition to those 8 tabs, there is a special tab called Macros that shows the contents of the visitrc file. If you record Python code to the Macros tab then that Python code is turned into a function that can be called in response to a button click from a button in the Macros window.

## 15.2.1. Recording a macro¶

Here are the steps involved in recording a macro.

1. Open the Command window and choose to Store commands in Macros.

2. Click the Record button

3. Perform any GUI actions that you want to record to a single button click.

4. Click the Stop button in the Command window.

5. Enter the name of a Python function in which to store your set of recorded commands.

6. Enter the text for the macro button as it will appear in the Macro window.

7. Now, the Macros tab will contain a function for your recorded commands and it will call the RegisterMacro function from the VisIt Python Interface to associate your Python function with the named button. Note: Remembe that you can edit the recorded Python code to suit your needs. You can generalize the code so it can, for example, operate on the active database instead of a specific database. The state information that you need to generalize can often be returned by the GetGlobalAttributes(), GetWindowInformation(), or GetMetaData() functions.

8. Click the Update macros button to make VisIt update the buttons in the Macros window so it will contain your new button.

9. No further steps need to be taken to save your macro since the macro definitions in the Macros tab of the Command window will be automatically saved to your visitrc file.

10. Click the new button in the Macros window whenever you want to replay the recorded set of commands.