Recording a Macro (Creating a Macro File) [ HP LaserRX/MPE User's Manual: Analysis Software ] MPE/iX 5.0 Documentation
HP LaserRX/MPE User's Manual: Analysis Software
Recording a Macro (Creating a Macro File)
The Record command appears under the HP LaserRX/MPE Macro menu.
Figure 8-1. Record Command
When you select the Record command, the Record dialog box appears.
Figure 8-2. Record Dialog Box
The commands and functions that you complete during a recording session
are stored in the macro file listed in the Filename box. When you create
a macro file, you enter a file name; the .REC extension is supplied
automatically. (Files with the .REC extension in the current directory
appear in the Files list box.)
Tip When you create the file, you should add a description of the macro
file to help identify it. This description is saved in the macro
script file and cannot be added after the macro has been recorded.
CAUTION You cannot append to an existing macro file. If you enter the
name of an existing macro file and then begin recording, the
contents of the original file will be lost.
If you need to pause the recording process, you can use the macro Pause
command. When you're ready to resume recording, highlight the Pause
command again to uncheck or disable it.
Example: Recording a Draw Macro
To create a macro that will automatically draw the Global Bottlenecks
graph follow the steps below.
1. Invoke HP LaserRX/MPE.
2. Select the Macro Record command.
The Record dialog box appears.
Figure 8-3. Record Dialog Box
3. In the Filename box, type Draw.
4. Tab down to the description box and enter a description of this
macro.
5. Click OK to close the dialog box and start recording the DRAW
macro.
When macro recording is enabled, the cursor changes to the record
cursor shown below:
Figure 8-4. Record Cursor
6. Use the record cursor to select the Open Local command under the
File menu.
7. Double-click on the DEMO.PRF file listed on the Open Local dialog
box.
Figure 8-5. Open Local File Selection
8. Select the Draw Graphs under the Draw menu and make the following
selections on the dialog box:
a. Select Global Bottlenecks.
b. Select an X-Axis of 1 day.
c. Enable Ignore Weekends.
d. Select Points Every Hour.
e. Select a Shift of 8:00 AM to 5:00 PM.
f. Select a Starting Day of Last.
See "Relative and Absolute Dates" in "Guidelines for
Using Macros" .
g. Click OK to draw the Global Bottlenecks graph.
The macro recorder logs the Draw command together with the logfile
name and all other options selected on the dialog box.
9. Select the Stop Recording command under the Macro menu.
Figure 8-6. Stop Recording Command
The cursor returns to an arrow.
The DRAW.REC macro is complete. To see it work, use the Play Back
command as described in the next example.
NOTE Because a logfile was opened as part of the macro, this macro will
open the same logfile each time that it runs. For a sample macro
that could be used with other logfiles, see "Example: Automated
Printing of Graphs" .
Example: Playing Back the Draw Macro
To play back the DRAW.REC macro that was created in the previous example,
proceed as follows:
1. Invoke HP LaserRX/MPE.
2. Select the Macro Play Back command.
The Play Back dialog box appears.
Figure 8-7. Play Back Dialog Box
3. In the Filename box, type Draw and click OK
(or double-click on the DRAW.REC entry in the Files list).
4. After the graph appears, double-click its Control-menu box to
close it.
5. Use the Close command to close DEMO.PRF.
See "Example: Automated Printing of Graphs" for a sample
macro that automatically closes the open graph and logfile.
Example: Automated Printing of Graphs
Follow the steps below to create a macro that will automatically print
the Global Bottlenecks graph.
NOTE Printing may go faster if you disable the Microsoft Print Manager
via the Windows Control Panel before you invoke HP LaserRX/MPE.
Invoke HP LaserRX/MPE and proceed as follows:
1. Select the Open Local command under the File menu.
2. Double-click on the DEMO.PRF file listed on the Open Local dialog
box.
Figure 8-8. Open Local File Selection
Note that, in this example, you do not record opening the logfile.
Because a logfile isn't opened as part of the macro, you can use
this macro on other logfiles later on.
3. Select the Macro Record command.
The Record dialog box appears.
4. Type PRINT in the Filename box.
5. Tab down to the description box and enter a description of this
macro.
6. Click OK to close the dialog box and start recording the
PRINT.REC macro.
The cursor changes to the Record cursor.
Figure 8-9. Record Cursor
7. Use the record cursor to select the Draw Graphs command.
8. Make the following selections on the Draw Graphs dialog box:
a. Select Global Bottlenecks.
b. Select an X-Axis of 1 day.
c. Enable Ignore Weekends.
d. Select Points Every Hour.
e. Select a Shift of 8:00 AM to 5:00 PM.
f. Select a Starting Day of Last.
See "Relative and Absolute Dates" in "Guidelines for
Using Macros" .
g. Click OK to draw the Global Bottlenecks graph.
The macro recorder logs the Draw Graphs command together with the
default logfile name and all options selected on the dialog box.
Remember that we did not start recording this macro until after we
had opened a logfile. The last opened logfile becomes the last
active or default logfile. When played back, this macro script
will use the last active (default) logfile, whatever it is at the
time.
9. After the Global Bottlenecks graph is drawn, select the Print
command.
A control box appears that asks you to click on the graph/table.
10. Click OK on the control box.
The record cursor changes to a cross.
11. Use the mouse to position the cross cursor over the Global
Bottlenecks graph. Click on the graph.
A control box appears that reminds you that actual printing will
not take place at this time.
12. Click OK on the control box.
When this print macro is recorded, it includes a number that
identifies the graph in it.
In this example, we record a macro that will print one graph. If
you wanted the macro to print more than one graph, at this point
you would:
a. Leave the Global Bottlenecks graph displayed. Use the
record cursor to select the Draw Graphs command.
b. Deselect the Global Bottlenecks graph from the graph list.
c. Select another graph.
d. Click OK to draw the graph.
e. Follow the steps above to record printing the new graph.
13. Double-click on the Control-menu box of the Global Bottlenecks
graph to close it.
If you've recorded a macro that opens more than one graph, you
should close (double-click) each open graph.
By recording the closing of the graph, you ensure that the macro
cleans up after itself.
_________________________________________________________________
NOTE Usually, a macro will close only the graphs or tables that
it creates. If a macro closes a graph or table that it
hasn't created, it will close the last active one.
You can close any number of windows regardless of how many
graphs and logfiles are open.
_________________________________________________________________
14. Select the Stop Recording command from under the Macro menu.
Figure 8-10. Stop Recording Command
The cursor returns to an arrow.
The PRINT.REC macro is complete. To see it work, select the Play Back
command. Make sure a logfile is open. Remember that during playback,
the graph will actually be printed.
Unattended Printing.
When you select a device for unattended playback of a print script, use
local printing and plotting devices or networked devices such as the HP
LaserJet. A networked plotter should not be used for unattended printing
because it always asks whether or not paper is loaded.
MPE/iX 5.0 Documentation