| Barry MacDonnell's
Toolbox for WordPerfect
Macros, tips, and
templates for Corel® WordPerfect® for Windows®
| Page updated Oct 9, 2020
Convert Case ("toggle case") - a macro that converts the word under (or to the left of) the cursor, or the words you selected, into one of these formats -
• UPPER CASE ['ALL CAPS']
WordPerfect menu choices on this page refer to the <WordPerfect> menu (right-click on the top menu bar for a choice of menus). If you use a <Microsoft Word> menu, the choices might be absent from your menu (but not from the program), or they might be found under another menu selection. See here for more.Related pages and other items -
• CapFirst - A macro that converts just the first letter in a sentence to UPPER case if it's not already in upper case, without affecting any other upper case letters in the sentence.
Similar to the Convert Case macro's "Lower case [except words that begin sentences]" — but it converts only the first letter of the sentence, which might be more useful during some editing tasks.
• RLCaps - A macro that finds every capital (uppercase) letter, then emphasizes it with redline. It can optionally add large size, bold, and/or italics, Like This. Changes are easily undone.
This makes capital letters easy to find when proofreading the document. (See the footnote on that page to add a new font to upper case letters.)
• ConvertV - A macro that converts selected text to Initial Capitals, then replaces any uppercase in the selected block to their lower-case equivalents (e.g., it converts "V." and "VS." to "v." and "vs." — or "SMITH V JONES" to "Smith v Jones").
No menu appears to make it very quick and easy to use.
• Smallcaps2Caps - Convert Small Caps (a text attribute: Format, Font, Small Caps) to ALL CAPS with the small macro in Footnote 3.
Convert case.wcm (v1.04)
Convert case is one
of two macros in the Download ZIP file (◄- left sidebar).
Background, purpose and advantages
WordPerfect X8 and earlier versions have a built-in menu, Edit,
Convert Case, to convert the current word or a selection of text to -
WordPerfect X9 (released May 2018) and later versions include another option which converts all selected text to lower case except for the first letter of sentences, which letter is converted to upper case.
• Sentence Case.
[Side note: What if you are using WordPerfect X8 (c. 2016) or earlier?
When the macro is played (Tools, Macro, Play) it will pop up a small push-button menu [screen shot] to let you convert the word under the cursor, or the word(s) that you have selected, into -
#1, #2, #4, and #5 are the same as on the WordPerfect X9 and later
version's Edit, Convert Case menu choice and operate the same way.
Choices #3 and #6 are particular to this macro. Choice #6 — reversing the case of all letters in
a selection of text — can correct for accidental use of the Caps Lock
key (e.g., it changes tHIS to This). [Prevention tip: See "Make the <Shift> key turn <Caps Lock> off automatically" here.]
All 6 choices can be accessed with fewer keystrokes or mouse clicks than by using the WordPerfect
menu. See "Make it easy to use" below.
Any existing text formatting (bold, etc.) in the selected text is not affected.
☼ If you prefer the keyboard to a mouse, consider assigning the macro to an available keyboard shortcut such as Alt+c. Then pressing Alt+c followed by pressing the number 2 would instantly change the selected text to Title Case.
☼ For the two Initial Capitals menu choices (#2, #3) on the Convert case macro's menu, be sure to read "Initial Capitalization in Titles and Headines" below.
☼ The Initial Capitals choice on the WordPerfect menu as well as on the Convert case macro's menu (#2, ...Main Words) depends for its operation on a special WordPerfect file which contains minor words (e.g., "a") that should be excluded, such as in headlines or titles. This exclusion file is an editable file whose contents differ according to your language version. See Footnote 2 below for more information.
Since the macro's menu uses push buttons that can also be operated with keyboard shortcut keys, the macro and its choices can be used entirely from the keyboard by assigning the macro to an available and easy-to-remember keyboard combination (i.e., a "shortcut") such as <Alt+C>.
Then, for example, when you press
<Alt+C> and immediately follow it with the number of the menu item (#1 - #6), the macro will dismiss the menu and
perform the chosen function on the current word or the selected text. You can also press <C> for Cancel.
To assign the macro to a shortcut key combination, see http://wptoolbox.com/tips/Assign.html.
You can, of course, use a mouse to make your conversion choice by clicking the appropriate button on the macro's menu. If you use a mouse, you may prefer to create a button on a toolbar that brings up the macro; see http://wptoolbox.com/tips/CreateTB.html.
If you prefer using menus, it might even be useful to replace the built-in WordPerfect Edit, Convert Case menu selection with a new selection that plays the macro; see http://wptoolbox.com/tips/NewMenu.html for help with doing this.
☼ Except for the reverse case option this macro leaves the converted text selected so that you can make other changes to that text. Be careful: Starting to type something when text is still selected in Windows will cause the new material to immediately replace the entire selection. (If that happens Ctrl+z should restore things.)
Simply press the arrow key (or click elsewhere) and you can move past the selected text and de-select it at the same time.
If you prefer to have the macro de-select the text automatically, see the redlined instruction in the macro code, just below the Label(End@) command.
[Macros can be edited like any other WordPerfect document; simply either click Save & Compile from the macro toolbar that should be visible or just save the file with File, Save.]
☼ [WordPerfect X8 and earlier versions:] The fifth menu choice, Lower case [all letters in the selected text], might take a few seconds on very large blocks of text. The screen will go blank while it does the conversion.
☼ You should always review changes to be sure they are what you expect. You can usually undo changes with Edit, Undo or <Ctrl+Z>.
For example, hyphenated words such as "de-select," "natural-born," etc., are considered a single word in WordPerfect; thus the use of the Initial Capitals and Reverse Case options will ignore the second part of such compound words. This might or might not be what you want.
☼ Initial capitalization in titles and headines.
According to the Chicago Manual of Style (CMS) FAQ site (Capitalization,Titles), the rules about titles or "headline-style capitalization" are somewhat flexible. As they stated in an old FAQ:
In regular title capitalization, also known as headline style, the first and last words and all nouns, pronouns, adjectives, verbs, adverbs, and subordinating conjunctions (if, because, as, that, etc.) are capitalized. Articles (a, an, the), coordinating conjunctions (and, but, or, for, nor [so, yet]), and prepositions, regardless of length, are lowercased unless they are the first or last word of the title or subtitle. ...
They conclude that "considerations of meaning and aesthetics can probably be let in". In other words, the rules are sometimes broken, depending on what seems appropriate at the moment. Still, rules should be understood before you break them.
How does this relate to WordPerfect?
WordPerfect stores exceptions to the rules for initial capitalization (i.e., when you use Edit, Convert Case, Initial Capitals) in a normal WP file, WTNNXX.ICR (where NN is your WordPerfect version number and XX is your language version). Words in this file will be NOT be capitalized when the Initial Capitals feature is used.
The WTNNXX.ICR file can be edited as any other WP file to add or delete words (punctuation is ignored) (see Footnote 2). However, it does not contain a comprehensive list of prepositions (see the CMS quote above). In any case, many such words can also be nouns, adverbs, or adjectives. So, bear in mind that if you use WP's Initial Capitals feature with titles or headlines, you may want to inspect the conversion to ensure it meets standard rules such as those embodied in the CMS, or that it meets aesthetic needs [e.g., John Updike’s Rabbit is Rich (lower case "i") makes more sense than Rabbit Is Rich (upper case "I"), even though the rule says the word "is" should be capitalized, and WP will dutifully capitalize it].
On top of this, for some reason there is a large difference in the exception lists for the US/CE language versions of the .ICR file (which contain 70 words) and the UK/OZ versions (13 words). For example, the letter "a" is not in the UK/OZ exception files, and the conjunction "nor" is missing in all four English language lists, which means it will always be capitalized.
WordPerfect is a computer program, after all. Don't expect it to take the place of your own judgment.
☼ Initial Capitals for Main (or All) Words is something that is generally used for titles or headlines (see previous tip) — not for headings. See, for example, Practical Typography - headings here.
[Note: The function of this macro is included in the Convert case.wcm macro above (and is available from its pop up menu), but a separate Reverse case.wcm macro file is also included in the download ZIP archive for those who just need that function.]
This macro is designed specifically to let you quickly reverse the case of each letter in recently typed text (or any text).
This can help when the Caps Lock key was left
"on" while you were typing and you didn't notice because you weren't
looking at the screen at the time.
"tHE iNTERNATIONAL bUSINESS mACHINES cORPORATION (ibm) IS AN aMERICAN MULTINATIONAL TECHNOLOGY CORPORATION."
This reverses the case of the letters from what you intended. The macro can correct this error almost instantly, to this:
"The International Business Machines Corporation (IBM) is an American multinational technology corporation."
The macro can also be useful to instantly
change a lower case word under (or to the left of) the cursor to all
CAPITAL letters, or vice versa.
place the cursor on the incorrect word or
select the incorrect text (e.g., use Shift+arrow or the mouse), and
then play the macro. [Note that no menu is displayed since none is
needed. However, with version 1.01 there is a pop up dialog to show a
running count of letters processed and also allow you to cancel further
operation of the macro (useful if you selected too much text).]
☼ For quicker access to the macro you can assign it to a shortcut key, toolbar button, or menu choice (see http://wptoolbox.com/tips/EasyPlay.html). For example, if the shortcut key Alt+Z is available for assignment (see http://wptoolbox.com/tips/Assign.html), it might be a good candidate to play the macro since a similar shortcut, Ctrl+Z, is the standard Undo key for many other things in Windows.
☼ This macro works only on ordinary alphabetical characters, skipping over any numbers, keyboard symbols, punctuation, and format codes. It also skips WordPerfect symbols from the symbol sets (Insert, Symbol) — including alphabetical "characters" since they are not standard (A-Z, a-z) alpha characters, as can be seen in Reveal Codes.
☼ If there are any bookmarks (Tools, Bookmarks) inside the selection of text they might be relocated elsewhere in the selected area. (This is an artifact of using a new paired bookmark to delimit the text to be converted which also contains a bookmark. See the top of the macro code for how this is done.) But this should be fairly rare since the macro was designed to be used soon after incorrectly typing new text — presumably before any bookmarks might be inserted in that text.
☼ There are a couple of ways to help prevent the reversed-case problem in the first place:
(1) Enable the CapsFix checkbox option in Tools, QuickCorrect, Format-As-You-Go
- and/or -
(2) allow the Shift key to automatically turn Caps Lock off, as was the method used back in the typewriter days. (This works in all Windows programs, including WordPerfect.) For the method see "Make the <Shift> key turn <Caps Lock> off automatically" at http://wptoolbox.com/tips/CapsFix.html.
[This footnote was removed when the Convert Case macro included an option to capitalize the first letter of ALL words in a selection of text (i.e., in v1.02).]
[Continued from above ....]
... WordPerfect stores exceptions to the rules for initial capitalization (i.e., when you use WordPerfect's Edit, Convert Case, Initial Capitals) in a normal WP file, WTNNXX.ICR (where NN is your WordPerfect version number and XX is your language version).
Words in this file will be NOT be capitalized when the Initial Capitals (for Main Words) feature is used.
The WTNNXX.ICR file can be edited as any other WordPerfect file to add or delete words (punctuation is ignored).
Here's an easy way to do it:
Exit from WordPerfect, then -
(1) Make a copy of your WordPerfect program's .icr file to another folder [on my Windows 10 system (with WordPerfect X9) the original file is in this folder:
C:\Program Files (x86)\Corel\WordPerfect Office X9\Writing Tools].
(2) Rename the original file (e.g., to WT19us.icr.OLD) to back it up. Note that since the original is a program file you will need administrator rights to rename it.
(3) Open the copied file in with Windows Explorer's (right-click-on-filename) "Open with...WordPerfect...".
(4) Modify the copied file while it's open in WordPerfect (it's just a list of words, each on a separate line).
(5) Save this modified file with the original name (e.g., WT19us.icr).
(6) Close WordPerfect.
(7) Move (or copy) the modified file back into the original folder (e.g., C:\Program Files (x86)...etc.). [In Windows Explorer it should appear adjacent to the backed up version.]
(8) Re-launch WordPerfect.
These steps might be simplified by changing Windows permissions for the file (via its Properties) — but they work easily enough to revise the file without impacting the original.
The Convert Case macro (see above) has the option, Initial Capitals For All The Words, which simply uses a small trick to effectively make the .ICR file invisible to the program (while the macro runs). You can view this method in the macro's code.
An alternative macro to convert text to initial capitals for all words in a selection of text is to use this one-line macro on the selection:
Type (ToInitialCaps (?SelectedText; FirstOfEachWord!))
The macro will replace the text selection with the same words — but every word will be capitalized. [Thanks to Brad Robertson at WordPerfect Universe for this tip which he posted here.]
While this particular one-line Type(...) macro is simple and potentially useful to many users, be aware that it will remove formatting (e.g., bold, italics, etc.) from the selected text. If this is not acceptable, please consider using the Convert Case macro's Initial Capitals For All The Words option instead.
[Continued from above...]
On occasion you might apply the text (font) attribute, Small Caps, to a selection of text -- and later decide it should have been ALL CAPS. When this happens in several places or in several open documents it can be quicker to use a macro to do the job. Here's one to do the job.
Tip: To copy the code below into your WordPerfect program to create a working macro see here.
Note: You can remove the 3 lines of Optional code that pauses the macro at each instance found. Be sure to also remove the Label(NextOne@) command, too.
// Macro code begins here
// Smallcaps2Caps.wcm - Converts all text with the Small Caps attribute to
// all capital (UPPER case) letters.
Display(On!) PosDocTop vCount:=0
vSmCapsOn=NTOC(65054) vSmCapsOff=NTOC(65055) // (<= used in SearchString)
// ----- Optional code: Pause for confirmation at each item located:
Messagebox(vAns;"";"Process this item?"; YesNoCancel!)
If(vAns=2) Go(Exit@) Endif // (if Cancel)
If(vAns=7) Go(NextOne@) Endif // (if No)
DeleteCharPrevious // (delete the paired SmCaps codes)
MatchSelection // (restore to default)
Messagebox(;"Finished!"; vCount+" items were processed.")
// Macro code ends here