HP 3000 Manuals

Replace Line From Macro [ HP EDIT Reference Manual ] MPE/iX 5.0 Documentation


HP EDIT Reference Manual

Replace Line From Macro 

Purpose 

Enables you to replace one or more lines of text from an executing macro.

Default Syntax 

None

This command does not have a default key assignment.  You can either
assign a key to the command using the Assign Key command or issue the
command using Execute Editor Command.

Description 

This command, when executed within a macro, suspends a currently
executing macro and enables you to substitute a line of text with other
text.

This command combines the functions of the Delete Line and Insert Line
commands.  When you execute a macro containing this command, HP EDIT
deletes the current line [REV BEG] or selected line block[REV END] and
inserts a new line in Text Entry mode, enabling you to insert text.  You
can optionally specify a count preceding the command if you want to
delete more than the default of one line before inserting replacement
text.

Command Process 

When the macro pauses for your input, HP EDIT displays the prompt Waiting 
for keyboard input on the message line.  You can then insert replacement
text.

When you have finished substituting text for the deleted lines, pressing
/ and Return causes HP EDIT to resume execution of the macro by finding
the next occurrence of the search pattern, if it exists.  After you have
replaced the last occurrence of the search pattern, the macro terminates.

Syntax Considerations 
[REV DEL]

Refer to the Define Macro command for information about the required
syntax.

This command differs from other related commands with key assignments in
that if you do not assign a key to this command, you must type the text
name of the command to execute it within a macro.  Since this command is
only useful within a macro, it is recommended that you assign a key to
the command to reduce the macro space it consumes.

Procedure 

To execute this command within a macro: 

   1.  Construct the macro containing this command using proper macro
       syntax.
       [REV BEG]

   2.  If you are replacing a line block, select the block you want to
       replace.

   3.  Execute the macro by pressing the m key.  HP EDIT displays Specify 
       macroname on the message line.  If the macro is preemptive, press
       the macro define key.[REV END]

   4.  Type the macro name as specified in the macro.  HP EDIT executes
       the macro, deletes a line, inserts a new line where you can enter
       text, and pauses for your input.

   5.  Provide the input and then press / and Return to return to Command
       mode.  HP EDIT resumes execution of the macro.

Example 

To construct, define, and execute a macro that pauses for you to replace 
the second line below: 

            This line of text is acceptable.
            This line of text must be replaced.
            This line of text is also acceptable.

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

   2.  Type in the following macro beginning at the cursor position:

            mX:+EReplace Line From ^m;/^m

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

   4.  Execute the Define Macro (z) command.  HP EDIT deletes the macro
       from the screen and stores it for subsequent execution.

   5.  Press the X key.  HP EDIT replaces the second line with a blank
       line and then waits for your input.

   6.  Type This text replaces the old text.  and then press / and
       Return.  The lines now appear as:

            This line of text is acceptable.
            This text replaces the old text.
            This line of text is also acceptable.

Related Commands 

       Append Line From Macro
       Append To Character From Macro
       Append To End Of Line From Macro
       Define Replace Pattern From Macro
       Define Search Pattern From Macro
       Insert Character From Macro
       Insert Line From Macro
       Overwrite From Macro
       Replace Character From Macro
       Replace Line
       Replace Word From Macro



MPE/iX 5.0 Documentation