HP 3000 Manuals

Execute Macro [ HP EDIT Reference Manual ] MPE/iX 5.0 Documentation


HP EDIT Reference Manual

Execute Macro 

Purpose 

Runs a macro and returns to the current input level.

Default Syntax 

[n] m

where n represents the number of times you want the macro to execute.
The default value of n is 1.

Description 

This command executes a preemptive or non-preemptive macro.  In order to
execute a macro from within a macro, you must use either this command or
the Go To Macro command.  A key assigned to a non-preemptive macro does
not preempt the same key assigned to an HP EDIT command.  Consequently,
the same key can be assigned twice for different purposes.

Applications 

You typically use this command when you want to execute a single macro or
a group of nested macros.

One method of executing a macro longer than a single line is to first
chain a set of "submacros".  Refer to the Define Multiple Macros command
for information about defining chains of macros and refer to the Go To
Macro command for information about executing chains of macros.

You can execute several macros as interconnected subroutines by nesting
up to ten levels of macros and then using this command to execute them.
Refer to the example for information about defining nested macros.

Command Process 

When you execute the command, HP EDIT prompts for the macro name, which
is the key assigned to the macro.  If the Meta key precedes the assigned
key and you press a Meta key (ESC or $) in response to this prompt, HP
EDIT prompts a second time for the Meta macro name.  If you specify a
valid macro name, HP EDIT executes the macro.  If you specify an
undefined macro name, HP EDIT displays Macro does not exist on the
message line.

If you want to abort a running macro after you execute this command,
press the CTRL and y keys.  If you want to cancel the effect of a macro
that has just finished executing resulting in text modifications, use
either Undo Last Command or the Undo Sequentially command.

Procedure 

To execute a macro: 

   1.  Press the m key.  HP EDIT displays Specify macroname on the
       message line.  If the key assigned to the macro is prefixed by the
       Meta key, proceed to step 2.  If not, skip to step 3.

   2.  Press the ESC or $ key.  HP EDIT displays Specify meta-macroname 
       on the message line.

   3.  Press the key assigned to the macro that you want to execute.  HP
       EDIT responds to a valid key by executing the corresponding macro.

Example 

To construct, define, and execute nested macros that delete either 1, 3, 
5, or 7 characters from text: 

   1.  Insert a new line in text by executing the Insert Line (I)
       command.

   2.  Type in the following set of macros:

            mj=dmkdQ  ***  These macros demonstrate nesting.
            mk=dmld
            ml=dmmd
            mm=d

   3.  Press the / and Return key to exit Text Entry mode and enter
       Command mode.

   4.  Move the cursor to the first macro of the group and execute the
       Define Multiple Macros (ESC z) command.  HP EDIT removes the four
       macros from the screen and stores them for subsequent execution.
       HP EDIT also displays the following message:

            4 macros defined

   5.  Press the m key.  HP EDIT displays the following prompt on the
       message line:

            Specify macroname

   6.  Press either the m, l, k, or j key depending on whether you want
       to delete 1, 3, 5, or 7 characters from the current line.

Related Commands 

       Begin Capture
       Capture Macro
       Define Macro
       Define Multiple Macros
       Delete All Macros
       Delete Macro
       Go To Macro
       Insert All Macros
       Insert Macro
       Quit Macro
       Show Macros
       Use Current Key Assignment



MPE/iX 5.0 Documentation