Dec 232017
 
S&R is a sophisticated Search and Replace macro written in WordPerfect 5.0's Macro language.
File S-R.ZIP from The Programmer’s Corner in
Category Word Perfect
S&R is a sophisticated Search and Replace macro written in WordPerfect 5.0’s Macro language.
File Name File Size Zip Size Zip Type
S-R!.WP 36352 5946 deflated
S-R!.WPM 20556 3823 deflated
S-R.DOC 12457 5023 deflated
S-R.WPM 4560 1554 deflated

Download File S-R.ZIP Here

Contents of the S-R.DOC file


WPC
2BUVW-#|xn (Normal)Courier 10 Pitch)Marin (Normal)Marin (Bold)zNxxx
U^x
@\\\\\\\\\\\\W\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\&]@pPS2t"/Courier 10 PitchCobb Thin (Normal)Marin (Normal)
@Cobb Thin (Normal)Marin (Normal)Marin (Bold)204#|x"^3&B_S16>K_ 5$?^]]]]]]]]]11```Ilq}pf;HpzfzxXn~kY%]]\,&9w&]@pP#XX3,[email protected] PS"^:-IfZ8=ERf'<+Feddddddddd88gggPtxwmBOwm_urC\C\\8TaR`TP\d9=f9d\[email protected]_``U8%Jg&
Y%]]\,&9w&]@pPZ#XX3,[email protected] PS#^^:,"!^@pp
2
d4 P;U^ X`hp x (#%'0*,[email protected]:
x(08"`Search and Replace Macro Documentation
for SR.WPM (c) 1989
)by
%Doug McKay


SR version 2.0 6889



What it is:

SR is a sophisticated Search and Replace macro written in WordPerfect
5.0 Macro language. It is not a replacement for WP's builtin search
and replace facility. SR is designed to be as similar to WP's own
Search and Replace function as possible.



What it will do:

SR does what you've always wanted to be able to do with Search and
Replace. It will allow you to search for paired attributes (or text)
and replace them with other attributes (or text).

Here are a couple of instances where SR would be very helpful:

Say for instance you forgot that you wanted your titles to be underlined as well as bolded. You just tell SR to search for anything that
is bolded and add underlining.

You might be a lawyer who needs to transmit documents via a service
that cannot handle anything but plain text. You could have SR change
all occurrences of Redlining codes to text markers (maybe "redline.on"). Then you would send the document. On the other end, the
receiver would use SR to replace all occurrences of "redline.on" with
the actual redlining codes.



xIncluded in this archive (on this disk):

SR .WPM
`
The executable macro in compiled form.$

SR! .WPM
`
The fully commented source code.$

SR! .WP
`
A WP 5.0 document containing the text of S-R!.WPM.
SR .DOC
`
This documentation file.$

x
[email protected]

SR.WPM is a compiled version of SR!.WPM. In compiling the macro, I
have removed all comments, Tab's, and Carriage returns. I have also
changed all the labels from explanatory text to meaningless numbers.
The result is a macro that takes up less room (on disk and in memory
when executing), and runs about 10% faster on my 286 system.
@

SR!.WPM

SR!.WPM is a fully commented version of this macro. This macro is
executable, it just does not run as fast as the compiled version. I
provide it here so you can see how it operates.


SR!.WP

SR!.WP is a copy of the text of SR!.WPM. This file is provided for
those users who do not yet have WPCorp's WP 5.0 compatible macro
editor. Attempting to edit SR.WPM or SR!.WPM using WP 5.0's builtin macro editor will result in a "not enough memory" message. Even
though you won't be able to edit the macro using this text file, you
will be able to print it out, or just read it on screen to see how it
works. This file was created with Macro Translator, Version 2.1 by
Randall D. Jones.



Installation:

To install the macro, simply copy SR.WPM into your Macros directory
(as designated in WP's Setup) and it's ready to go.



Operation:

Replacement is always done from the cursor forward (reverse replacement
is not possible). Position the
cursor before the codes that you wish to act upon. To start the macro, press


AltF10

and then type


SR

The macro will then proceed through the following prompts:



w/Confirm? (Y/N) No

This prompt will appear at the bottom of the screen. This prompt is asking whether or not you wish to
have the macro pause for confirmation before it replaces the codes you are searching for.

If you answer Yes, you will be asked for confirmation before each and every replacement is done.

If you answer No, the macro will blindly replace every occurrence of your search strings with the
replacement strings. Be sure, before you answer No, that you wish to replace ALL occurrences of your
search strings. The result of a blind replacement that goes awry because of an incorrect search string can
be disastrous.



Delete original attribute/text? (Y/N) Yes

If you answer Yes (the default answer), the search string that you specify will be deleted when the
replacement string is added.

If you answer No, the search string that you specify will not be deleted. The replacement string will simply
be added.



Convert From:


Attribute: 1 Size; 2 Appearance; 3 User defined text: 0

You can convert from Size or Appearance Attributes or from User Defined Text.

The size and appearance attribute menus are exact duplicates of WP's own menus. You can select from any
of the items listed on the menus.
v)Converting From an attribute such as Bold, is fairly straight forward. Just select Appearance and then
choose Bold.

User Defined Text can be any text that you can type when you are prompted. Only text is allowed. No
special formatting or other codes are allowed. You will be prompted for both the On code and the Off
code. The On code is the text that marks the start of the block (e.g., left bracket "["). The Off code then
of course marks the end of the block (e.g., right bracket "]"). If the On and Off codes are the same (e.g.,
asterisk "*"), enter the same string in both places.



Convert To:


Attribute: 1 Size; 2 Appearance; 3 User defined text: 0

This prompt is the same as the "Convert From:" prompt in that it brings up the similar menus.

Converting To an attribute such as Bold, is fairly straight forward. Just select Appearance and then choose
Bold.

If you wish to replace attributes or User Defined Text with nothing, specify User Defined Text and just
press Enter at the On and Off prompts. It does not make sense to use this macro to replace attributes such
as bold or underline with nothing (WP's built in search and replace is much faster), but it does make sense
when you are searching for User Defined Text.


After entering both the "Convert From" and "Convert To" strings, the macro will proceed to do the replacing
as specified.

If you have chosen to convert from a User Defined Text string, two passes through the text are necessary.
The first pass prepares the text for replacement, and the second pass actually does the replacing. This
process is slower than converting from an attribute, but feedback is given so the macro does not appear dead.



Confirm? (Y/N) No

If you answered Yes to the confirmation prompt at the beginning of the macro, as soon as the first
preparation pass is complete, the macro will begin prompting you if you wish to replace what it has found.
The text that it will be replacing will be highlighted on your screen in the color you specified for "Blocked
Text" in WP's setup screen. If the Convert From string you are using is a Text string, the text specified
will not be visible on your screen with the rest of the highlighted text. It is unfortunate to have to do it
this way, but I couldn't a better solution. Perhaps better string handling capabilities will be added to WP's
macro language someday.

If you answer Yes to this prompt, the replacement will be made and the macro will go on to the next
occurrence.

If you answer No to this prompt, this occurrence will be skipped and nothing will be done to it.


Canceling the macro midstream will display the prompt


Canceling macro at operator's request

Replacement may not be complete

** Press any key to continue cancelation process **

If you had not yet begun the replacement process, pressing a key will terminate the macro almost
immediately.

If you were in the middle of the replacement process, the macro will proceed to clean up after itself as soon
as you press a key. During User Defined Text replacements, search strings are changed to markers and must
be changed back to their original strings or your text will be all goofed up. This clean up process makes
up to five passes through your text (depending on what searches are being done), so allow enough time forv)this before thinking that your machine is hung. Attempting to cancel (F1) the macro during this process
has no effect.

When the macro is finally complete, your cursor will end up back where it was when the macro was
started.



fProposed enhancements: (tell me if you'd like to see these)

X

Ability to search for more than one attribute at a time.$
X

Ability to replace with more than one attribute at a time.$
fX

Leave the screen in the current mode (Reveal Codes on/off) while macro is executing.$
X

Add a small routine to allow installation of this macro into a keyboard definition without losing WP's builtin search and replace function.$
X

Ability to tell the confirmation prompt not to prompt anymore after verifying that the search strings are
good. Possibly "Confirm (Y/N/D)" for "yes", "no", and "don't confirm anymore".$
X

Ability to include codes as well as text in User Defined Text searches. It may not be possible to allow all
codes however.$



Revision history:


689 2.0p
pNear complete rewrite of code.$


p
`
$$
Added ability to search and replace with User Defined Text instead of just attributes.$


p
`
$$
Enhanced feedback to user while macro is running.$


p
`
$$
First distribution of macro in compiled form.$


p
`
$$
Included documentation for the first time$

589 1.2p
pAdded full comments to source code.$


p
`
$$
Enhanced error checking.$

1188 1.1p
pFixed a problem with removing the original attribute code.$

1088 1.0p
pOriginal Release.$





Notices:

SR.WPM, SR!.WPM, SR!.WP, and SR.DOC are copyrighted files.
They may be distributed by any means
as long as the original UNMODIFIED files are all included. They may be changed to suit your needs. I
am not asking for any registration fees at this time. I can be reached in the following locations (listed from
most preferred to least preferred):


The Source
Participate -- Doug McKay

p
Source Mail -- EX1019

CISp
EasyPlex -- 72460,461


Doug McKay

294 East Nineta Circle

Orem, Utah 84057

(801) 2247288 -- (most non working hours)


Enjoy it, and let me know what you think!


 December 23, 2017  Add comments

Leave a Reply