Home | Tips | Library | Other Authors | Other WP Sites | Writer's Links | Contact | Site Map | Donate

Barry MacDonnell's
Toolbox for WordPerfect

Macros, tips, and templates for Corel® WordPerfect® for Windows®
© Copyright 1996-2017 by Barry MacDonnell. All Rights Reserved.

Page updated Oct 12, 2016

Convert Case ("toggle case") - a macro that converts the word under (or to the left of) the cursor, or the word(s) that you have selected, into one of these formats -

• UPPER case [all CAPS]
Initial Capitals for the Main Words
Initial Capitals For All The Words
Lower case [except words that begin sentences]
Lower case [all letters in the selected text]
Reverse case [change each letter to opposite case]

    [Reverse case is also included in the download ZIP file as a separate macro; see below]

Download CONVERTCASE.ZIP (v1.02; 09/18/15; 24,539 bytes)

Convert case.wcm was written in WordPerfect X5 and tested in WPX7. Reverse case.wcm was written in WPX7.

Downloading, Documentation, Modifications, and Support

Disclaimer

Note

WordPerfect menu choices (below) 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.


Convert case.wcm (v1.02)

[One of two macros in a ZIP file. See the download link in the box on the left sidebar. If you need help, see the Downloading... link.]

Purpose and advantages

WordPerfect has a built-in menu selection, Edit, Convert Case, to convert the current word or a selection of text to -

•  lower case,
•  UPPERCASE, or
•  Initial Capitals.

However, the first choice on that WordPerfect menu (lower case) has one limiation: It still leaves the first word of sentences capitalized in a selection of text. This appears to be by design. Hence, the Convert Case.wcm macro includes a choice to convert all letters in a word or selected block of text to lower case, even those letters that begin sentences.

The third choice on that same WordPerfect menu (Initial Capitals) 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.

Another advantage: Using the Convert Case macro, all six conversion choices can be accessed in fewer keystrokes or mouse clicks than using the WordPerfect menu. 

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 -

●    UPPER case [ALL CAPS],
●    Initial Capitals for the Main Words [a.k.a. Title Case, Headines],
●    Initial Capitals For All The Words [new in v1.02],
●    Lower case [except words that begin sentences],
●    Lower case [all letters in the selected text], or
●    Reverse case [change each letter to opposite case].

For the two Initial Capitals menu choices, be sure to read "Initial Capitalization in Titles and Headines" below.

The last choice -- 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).

Any existing text formatting (bold, etc.) in the selected text is not affected.

Make it easy to use

Since the macro's menu uses push buttons that can also be selected with keyboard shortcut keys, the macro and its choices can be used entirely from the keyboard (i.e., a "2-key" macro) 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.

Notes and tips

☼  Except for the reverse case option this macro leaves the converted text selected so that you can make other changes to that text.

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.]

☼  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.


    Reverse case.wcm (v1.0)

    [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.]

    Purpose

    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.

    If so, pressing the Shift key while typing with Caps Lock on reverses any capital letters, like this example:

    "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.

    Instructions

    Just 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.]

    If nothing is selected the macro will attempt to select the item under, or to the immediate left of, the cursor.

    Notes and tips

    ☼   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.) In Windows 7, for example (and presumably in other Windows versions), you can do this with a simple setting in the Windows Control Panel under "Change keyboards or other input methods". See http://wptoolbox.com/tips/CapsFix.html (which also shows how to do it Windows XP).



    Footnote 1

    [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).]


    Footnote 2

    [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 feature is used.

    The WTNNXX.ICR file can be edited as any other WP 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 the file [on my system it's in C:\Program Files (x86)] to another temporary folder;

    (2) rename the original file (e.g., to WP17us.icr.OLD) to back it up;

    (3) open the copied file in the temporary folder with 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);

    (5) save the modified file;

    (6) close WordPerfect; and

    (7) move (or copy) the modified file into the original folder (e.g., C:\Program Files (x86)).

    These steps might be simplified by changing permissions for the file (via its Properties) -- but they work easily enough to revise the file without impacting the original.

    Note

    The Convert Case macro's option Initial Capitals For All The Words 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.

    Ann 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.]

    Caution

    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.



    Page Top