| iTool User's Guide: Working with Macros |

## Recording Macros

You can create macros in two ways:

- Using the recording functionality in the iTools Operations Macros menu, described in this section

- Using the Macro Editor, described in Using the Macro Editor

To record a macro:

1. Start an iTool.

2. Select Operations Macros Start Recording.

3. If the Start Recording dialog appears (as it does if the Show dialog property is True), select whether to record manipulator steps and press OK, which puts the iTools system into recording mode.

Figure 8-2: The Start Recording Dialog

Figure 8-2: The Start Recording Dialog

Note For more information on recording manipulator steps, see Capturing Intermediate Manipulations.

4. Select operations or set properties as desired to create the macro.

5. Select Operations Macros Stop Recording to complete the recording.

Putting the iTools system into recording mode creates a new macro folder in the macro registry, using a unique name based on `New Macro' (as shown in the macro tree; see The Macro Tree). If the New Macro folder already exists, then the new name is New Macro (1) and so on until the system finds a uniquely numbered name. You can change the macro's name when macro recording finishes.

At the end of recording, IDL saves the completed macro, and the Macro Editor opens. Note that using the Stop Recording menu command is the only way to stop recording without exiting the iTools system. Changing tools or closing the tool does not stop recording, and a recording started in one iTool will continue to other iTools. You can select the Stop Recording command in any active iTool.

Note What you select in the iTools system before starting recording dictates what happens when you run the completed macro. For more information, see Macro Type Based on Recording Selection.

### Capturing Intermediate Manipulations

A manipulation such as Translate typically consists of a series of transformations based on the screen position of the mouse. They start with a mouse-down operation and end with a mouse-up operation, but each mouse motion while the mouse button is down generates a transformation. Typically, when a manipulation such as Translate or Rotate is recorded, a single macro item is created that contains the overall translation from mouse-down to mouse-up. This applies to the history item that is created whether recording or not. When this macro item is processed during macro playback, the complete transformation is applied, but the individual transformations based on the individual mouse motions are not available.

A different mode of recording has been added which allows a recording of a manipulation to save the individual steps based on each mouse movement. This is useful if the purpose of the macro is to demonstrate the transformation such as a smooth 3D rotation of a surface. This new mode records each step of the manipulation while the mouse is down, based on the original motion events from the operating system.

A new property, Record manipulator steps, has been added to the Start Recording operation. This Boolean property lets you specify whether to record the individual movements of a manipulation. The default value is False, meaning that the macro recording captures only the overall transformation rather than individual steps.

This property applies to the following manipulators when they are used within a recording:

- Rotate

- Translate (includes Image Plane translation)

- Scale

- View Pan

- View Zoom

While they are distinctly different properties, the value of Record manipulator steps is used to set the default value for the Display intermediate steps property of the macro itself. If Record manipulator steps is set to True when starting a recording, it is most likely that the user wants to see the intermediate steps during playback, so Display intermediate steps is set to True to provide that display.

Note that this property applies only to the macro item generated during recording. The history item generated for a transformation always consists of the single overall transformation, regardless of the setting of Record manipulator steps if recording as well as if not recording.

There are a number of other manipulators that are not affected by the Record manipulator steps property. For these manipulators, their primary purpose is to specify an overall movement with the mouse to specify how a succeeding operation will be applied. Therefore, an overall movement is always used to create a single macro item. These other manipulators are the following:

- Crop Box

- Range Box

- Range Pan

- Range Zoom

- Line Profile

- Surface Contour

IDL Online Help (March 01, 2006)