HP 3000 Manuals

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


HP EDIT Reference Manual

Replace Character From Macro 

Purpose 

Enables you to replace one or more characters in 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 by using the Assign Key command or issue the
command using the Execute Editor command.

Description 

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

This command combines the functions of the Delete Character and Insert
Character commands.  When you execute a macro containing this command, HP
EDIT deletes the current [REV BEG]character, blank space, or block of
text, [REV END]and places HP EDIT 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 character 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.  All of the original text to the right of the replace location
shifts to the right when you enter text.  If there is insufficient blank
space to add text or to fit the original text, HP EDIT wraps the exces
text onto then next line.

When you have finished substituting text for the deleted characters,
pressing / and Return resumes execution of the macro.

Syntax Considerations 
[REV DEL]

Refer to the Define Macro command for information about 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 block of characters, select a character
       block.

   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 the characters, 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 letter t in the word NOT: 

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

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

            mX=EReplace Character From ^m
            mx=AThis sentence is not/^mmX; correct./^m

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

   4.  Move the cursor to the first macro and execute the Define Multiple
       Macros (ESC z) command.  HP EDIT deletes the macros from the
       screen and stores them for subsequent execution.  HP EDIT also
       displays 2 macros defined on the message line.

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

            Specify macroname

   6.  Press the x key.  HP EDIT inserts the following line in text:

            This sentence is no_

   7.  Type the letter w at the cursor position, then press / and Return.
       HP EDIT completes the line as shown:

            This sentence is now correct.

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
       Replace Line From Macro
       Replace Word From Macro



MPE/iX 5.0 Documentation