|
|
|
Contains two macros: DeSpacer.wcm and Relocator.wcm
(which is a standalone macro that
contains a subset of the functions in DeSpacer, as explained
below). |
DeSpacer.wcm (v1.07)
Purpose
This macro changes text like this: "Once
upon a time, " to normally spaced text like this: "Once
upon a time,"
Background
In some documents, adjacent (i.e., contiguous)
spaces may have format codes embedded in them, which can
present a problem for traditional Find and Replace procedures
(e.g., using Edit>Find and Replace to find two spaces and
replace them with one space). Using Find and Replace to replace
multiple spaces with a single space will remove some (but, curiously,
not all) embedded codes, which is something that you probably
do not want.
Also, after you delete text or cut-and-paste
text to other parts of a document, you could end up with something
like this in your document (where <s> indicates a space
character):
The<s>quick<s>brown<s>[Bookmark]<s>fox....
Unlike some other macros or Find and Replace
methods, this macro won't delete any codes found between space
characters. Using this macro, the above line would be processed
and look like this in the Reveal Codes window:
The<s>quick<s>brown<s>[Bookmark]fox....
Additionally, any misplaced spaces adjacent
to WordPerfect format codes can be relocated (menu option). For
example -
The<s>[Und On]quick<s>[Und Off]brown<s>fox.... (The quick brown fox....)
will be changed to this -
The<s>[Und On]quick[Und Off]<s>brown<s>fox.... (The quick brown fox....)
Note: The exceptions to relocating spaces
in this way are spaces adjacent to Font (type or size) codes,
where users may want spaces in specific locations when a new
font or size is applied. Therefore, spaces adjacent to [Font]
and [Font Size] codes are skipped during macro play.
The Despacer macro can also delete unwanted
single spaces adjacent to certain codes (e.g., [HRt], [HPg],
[HCol], [Cell], [Table Off], [Col Def: Off], [Left Tab], etc.)
to help "clean up" the document. There may be some
(rare) situations where the macro will not remove all such solitary
spaces; therefore, a visual inspection may be required.
You can set these options off to leave such
spaces alone, and also turn the menu off to speed operation.
See the top of the macro's code for instructions.
Instructions
Open the document that you want to "despace."
Play the Despacer.wcm macro with Tools, Macro, Play (or
Alt+F10). You can choose various options on the menu that pops
up. [Screen shot] Click
OK. A "Working ... Please wait" message will appear
and you can cancel operation from it as well as from the main
menu.
Tips
- You can play the macro on a copy of your
document (File, Open, <name>, Open as Copy), then do a
comparison (File, Document, Compare) of the copy with the original
document to see what has been changed.
- You can assign the macro to a toolbar, keyboard
shortcut, or menu for easy access. See here.
Notes
- If the macro processes a lot of spaces, you
may not be able to undo the change with Edit, Undo (which is
limited to 300 levels of undo). Normally, the macro will process
the document with just one or a few levels of Undo -- but there
may be circumstances where this is not true. Therefore you should
either abandon the changes and Close without saving (then re-open
the document), or use File, Save As, and save it with a different
name.
- Processing a large document can take time,
given the way the macro operates. You may want to play it on
a copy of the final draft of your document, after all other edits
are done.
- Extraneous spaces can be almost anywhere
in a document. While the author has tested this macro "nine
ways from Sunday," there may be cases where spaces are not
removed, or are relocated improperly. If so, please contact the
author and he will try to solve the problem and make the macro
more robust. In light of this, however, it is recommended
that you always work on a copy or a backup of your document.(See
disclaimer.)
Relocator.wcm
(v1.0)
[This macro is based on the option in the
DeSpacer.wcm macro above, which can relocate solitary spaces
that might be misplaced adjacent to many paired format codes.
You can also download just the Relocator macro here.]
Purpose
Relocates any single (i.e. solitary) spaces
found inside various paired text attribute codes ([bold>..text..<bold],
etc.) to positions immediately outside those codes.
Mis-located spaces can happen if the user
has disabled the option "Use WordPerfect
9 text selection" (the Corel shipping default) in Tools,
Settings, Environment (found in WordPerfect 10 and later versions),
or if the user has received a converted-from-Microsoft-Word document.
For example, these single spaces (indicated
by <s>) will be relocated:
From -
[Main screen:] The
quick brown fox....
[Reveal Codes:] The<s>[Und
On]quick<s>[Und Off]brown<s>fox....
To -
[Main screen:] The
quick brown fox...)
[Reveal Codes:] The<s>[Und
On]quick[Und
Off]<s>brown<s>fox....
Notes
- The exceptions to relocating spaces in this
way are spaces adjacent to Font (type or size) codes, where users
may want spaces in specific locations when a new font or size
is applied. Therefore, spaces adjacent to [Font] and [Font Size]
codes are skipped during macro play.
- Only single spaces are relocated since it
must be assumed that some users actually desire multiple spaces
in certain locations. If you want to remove all extra spaces
use the author's DeSpacer macro (see above).
Instructions
Simply play the macro in any document. An
initial message allows you to proceed or cancel. When it has
finished searching the document it will display a message informing
you of the number of spaces it relocated. (A status bar message
shows the running count, which might be useful with long documents.
For short documents which are processed quickly, you might not
have time to see it.)
Tip: WordPerfect's
File, Document, Compare can be used to examine "before"
and "after" versions of the document.
|