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

Barry MacDonnell's
Toolbox for WordPerfect

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

Page updated Jul 24, 2008
WordPerfect Tips
Main tips page | Browse tips

Three easy ways to play macros, load programs, type keystrokes, or use built-in WordPerfect features (Part 2)
See Part 1:
How to create a toolbar button to play a macro, load a program or file, or use a built-in WordPerfect feature
See Part 3:
Customize your menu - How to add new menu choices or rearrange existing ones

SCROLL DOWN FOR SOME TIPS, EXAMPLES, AND EXAMPLES FOR ADVANCED USERS.

Assigning a macro, feature, program, or string of keystrokes to a key or key combination (i.e., a "shortcut" or "hot key")

You can customize your keyboard so that pressing the <Alt>, <Ctrl>, or <Shift> key (or any combination of these) plus a number or a letter (e.g., <Ctrl+1>, <Alt+Shift+m>), will -

  • play a macro, or
  • use a WordPerfect feature, or
  • start a program, or
  • send a string of keystrokes to WordPerfect or your current document.

These keys are often called "shortcut keys" or "hot keys," and their assignments are stored in a keyboard definition. This is a small internal area of the program you can access from the Tools menu.

You can have several keyboard definitions on your system: WordPerfect ships with several default definitions, but you can create custom definitions to suit your everyday needs or for special purposes.

Before you begin ...

... please note:

  • There are many WordPerfect features (e.g., inserting the current file's path and name) or WordPerfect functions that you may find useful candidates to assign to a key or key combination. (See Step #3 below for information on locating the list of these features.) While many are pre-assigned to menus, toolbars, or keys, many of them are not.
  • You may find that some of these features or functions are more useful when they are assigned to a toolbar since their button icons might make them easier to locate. If so, see Part 1 of this series of web pages. You can, however, assign them to new or existing menus as explained in Part 3.
  • To directly play a specific macro using a desired combination of keys -- in contrast to playing a macro by choosing one from a list with the standard <Alt+F10> keys or with Tools, Macro, Play -- you should first ensure the macro exists on your system. (This might seem obvious, but sometimes macros are moved or removed by others.) If it does not, you will need to create your macro first -- either by recording it (with <Ctrl+F10 or Tools, Macro, Record), downloading it from a site such as this one, copying the code from somewhere, or by writing the code for it, or by a combination of these methods -- and then save it in either your Default or Supplemental macros folder (which are specified in Tools, Settings, Files, Merge/Macro).
  • For a list of navigation and text selection keys that are used in WordPerftect's Windows (CUA) and DOS keyboard definitions -- the former is the "standard" or "default" keyboard used by the program -- you can read (left-click) or download (right-click, then Save Target As) "CUA-DOS.pdf," a small Adobe PDF file. Normally, you will not want to assign other things to these default keys unless you really need to use them for a special purpose; if you do, it is always a good idea to do so with a copy of the keyboard definition, as explained below.

How to do it

STEP 1
  • Click on Tools, Settings, Customize.
  • Click the "Keyboards" tab in the Customize Settings window, then select either the default keyboard definition for your version of WordPerfect (e.g., <WPWin Keyboard>) or another keyboard definition (e.g., <WPDOS 6.1 Keyboard>).
  • Then, do one of the following things.
    • Either click Create to create a new keyboard (based on the definition you just selected);
    • or click Copy to make a copy of the keyboard (choosing the desired keyboard in "Select keyboards to copy") and save it under a different name;
    • or click Edit to edit the existing keyboard.

IMPORTANT: You might feel more comfortable with this process by customizing a new keyboard definition or a copy of the current or default keyboard definition -- the first two alternatives above -- and leave your existing default or customized keyboards alone. In fact, this is recommended unless you are certain that you want to modify the existing default or custom keyboard. It makes it much easier to restore things if you do not like the changes you have made.

  • If you choose to Create a new keyboard definition or Copy an existing one, be sure to select it after you've modified it. You can do this by returning to the Customize Settings window with Tools, Settings, Customize. The keyboard definition you choose will remain in effect until you change it.

Tip: If you right-click the status bar -- the very bottom edge of the WordPerfect window -- you can then click Settings and check the box, "Keyboards." This will put a small icon on the status bar to let you quickly access the keyboard definition of your choice. [This works in WP8 and later, and may work in earlier versions.]

STEP 2
  • The Keyboard Shortcuts dialog box will now be open. Choose the key or key combination you want to change (reassign) in the left-hand "Choose a shortcut key" window. (You may have to scroll down a bit.) Choose an available letter or number combination -- perhaps Y+Alt or 3+Ctrl. In this example, the assigned macro (or feature or keystrokes) will play when you press <Alt+Y> or <Ctrl+3>.
  • Make a note so you'll remember which keys are being reassigned. (WordPerfect 11+ users can click the Print Report button to print a list of current shortcut key assignments.)

Tips:

    • The checkbox at the bottom, "Allow assignment of character keys," will bring up a list of ordinary character keys (A, B, C, a, b, c), punctuation marks, and extended characters. Normally, you will have little use for this list (except perhaps to assign a "quick save" macro to the period [full stop] key; see here for this trick), but certain infrequently used keys could be used to play a macro, such as the ` key (next to the 1 key). These might be best used to play a "two keypress" macro so that you still have use of the key for normal text entry. See the Advanced User section below.
    • You might also want to enable the "Shortcut key appears on menu" checkbox so that you'll see it in on WordPerfect's Insert menu.
STEP 3
  • Either click on the Remove Assignment button if the key already has an assignment;
  • or select the type of new assignment from the right-hand side of the dialog box, the area that shows four tabs: Features, Keystrokes, Programs, or Macros.

For features, under the Features tab, scroll down in the Feature categories drop list to choose the appropriate cateogory, such as File, Edit, View, Insert, Format, etc. In the lower "Assign a feature" list, choose the feature you want to assign to the keystroke or combination, and click on Assign Feature to Key. [You might find some features you didn't know about by scrolling through the list and trying them out in a test document.]

For keystrokes, under the Keystrokes tab, in the "Type the text to be inserted..." pane, enter the keystrokes, characters, or symbols you need, like this:

  • For keys such as <Alt>, use {Alt}. Other examples: {Ctrl}, {Shift}, {Space}, and {Tab}.
  • For combinations such as <Alt+F>, use {Alt+F}.
  • For text strings such as "the," enter them directly, or if this does not work, use {t}{h}{e}.
  • For accented characters (diacritical marks), use the numeric keypad and enter the proper code found in the Windows Character Map (under Start, Programs, Accessories, System Tools, Character Map).
    • For example, to enter an é in the Keystroke field, put the cursor in the field an type <Alt+0233> on the numeric keypad. (The leading zero is required.)
    • Charles Rossiter (Corel C_Tech) writes: "For example, I use Alt+e for e-acute, Ctrl+Shift+E for E-grave, Alt+a for a-umlaut, Alt+Shift+O for O-umlaut, Alt+Shift+C for C-cedilla, etc. There is no conflict with other Alt-key shortcuts (e.g., Alt+a for T_a_ble): Alt+a gives a-umlaut [i.e., press and hold the Alt key, then press a]; Alt,a gives T_a_ble (i.e., press and release the Alt key, then press a)."
  • For symbols, press <Ctrl+W>, select the symbol, then click Insert and Close on the Symbols dialog.
  • When done, click "Assign Keystrokes to Key."

Notes

  • There may be a limit to the number of characters (including the left and right braces) that you can enter into this dialog window.
  • WordPerfect X3 (and possibly later versions): Using WordPerfect X3 (build 13.0.0.565, perhaps in earlier and later builds, too) in Windows XP and Windows Vista means you can use only text strings and/or WP symbols in the Keystrokes pane. Script commands (i.e., {Alt}, {Space}, etc.) are ignored under Windows Vista. Consider using other methods of inserting boilerplate.
For programs, click the Programs tab, then the Assign Program to Key button. Locate and choose the exectuable program to play.

For macros, click the Macros tab, then click "Assign Macro to Key..." and select the desired macro from those listed in your macros folder. This will assign it to the shortcut key combination.

If you get a message, "Save macro with full path?" you most likely will want to answer "No." WordPerfect will then use the path to the default and supplemental macros folders specified in Tools, Settings, Files, Merge/Macro. If you answer "Yes" you can specify a path to a any other folder; however, if you do so the paths specified in Tools, Settings, Files, Merge/Macro will not be used for that macro.

Then click OK.

STEP 4
  • Close all dialogs with Close or OK.

Page Top

Tips

For macros, features, programs, and keystrokes:

You can use "reserved" keys such as <Alt+T> (which normally accesses the Tools menu). But if you do, the macro (or feature or program or keystrokes) will play instead of the Tools menu opening. However, you can still get at the reserved keys: If you press Alt, release it, and then press T (i.e., press the keys in sequence, not simultaneously), the Tools menu will open.

For macros only:

If customizing your keyboard is not an option, you may want to use an old WP trick to play a macro: Give the macro a name such as ctrlx.wcm or ctrlsftx.wcm, where "x" is a keyboard letter from A to Z or a number from 0-9. WordPerfect recognizes macro filenames that use "Ctrl" and "CtrlSft" (notice there's no "hi" in "Sft") in the filename as special. So, for example, if you press <Ctrl+J> or <Ctrl+Shft+J> the macro named CtrlJ.wcm or CtrlSftJ.wcm will play. This assumes, of course, that the macro exists in the default macros folder, which is specified in Tools, Settings, Files, Merge/Macro.

Notes

If the <Ctrl+(key)> combination you want to use as a macro filename has already been assigned in the Keyboard Shortcuts dialog, then that keyboard assignment will take precedence over any macro on disk with the same filename as the key combination.

For example, in WP10 and later versions, <Ctrl+1> normally inserts single spacing, and <Ctrl+2> inserts double spacing -- neither of which might be obvious when you press these keys. In this case, a macro on disk named Ctrl1.wcm will not play automatically when you press <Ctrl+1>, since these keys have already been assigned. However ...

You can verify if the combination is in use by opening the Keyboard Shortcuts dialog (see above steps); you may be able to change the current control-key assignment or remove it altogether to allow the named macro to play.

Page Top

Examples

Example #1 - Starting and Outline

Suppose you want to bring up the Outline feature quickly, using the keyboard instead of clicking on Insert, Outline/Bullets, OK. In the old DOS keyboard, for example, "Outline Body Text" was assigned to <Ctrl+T>, but you can assign this feature to any unassigned keystroke combination. Here's how.

    • Click on Tools, Settings, Customize, then the Keyboards tab. Select the keyboard you want to edit (e.g., <WPWin 9>), then click on Edit to bring up the Keyboard Shortcuts dialog. [As mentioned above under step 1, some users may feel more comfortable with customizing a new keyboard or a copy of the current keyboard definition, and leave their default keyboard alone.]
    • In the left pane, scroll down to an available key combo that you want to use (e.g., O+Alt) and select it with your mouse.
    • On the right side of the dialog, use Feature Categories to select the Insert category, then in the lower pane select Outline Body Text.
    • Click on Assign Feature to Key, and also (optionally) enable the "Shortcut key appears on menu" checkbox so that you'll see in in WP's Insert menu.
    • Click on OK, then Close (twice).

Now, when you press <Alt+O> the outline should start. Press <Alt+O> again when you want it to stop.

If you want to use a key combo to start an outline item with a new number (e.g., "1") you could assign "Outline Number Set..." to, say <Alt+Shift+O).

Example #2 - Deleting words the way Microsoft Word deletes them

Microsoft Word allows you to press <Ctrl+Backspace> to delete the previous word, even if there's a space after the word. In WordPerfect, this key combination works only if there is no space.

Here is a way to delete the previous word or delete the next word in WordPerfect -- even if there are spaces adjacent to the word -- with a key combination:

    • Click on Tools, Settings, Customize. Select the keyboard to edit under the Keyboards tab, then click the Edit button. The Keyboard Shortcuts dialog appears.
    • In the left pane, choose a shortcut key for the "delete the previous word" feature (such as <Left+Ctrl+Alt>).
    • Under the Features tab on the right side of the dialog, in the Feature categories list, select the Edit category. Scroll down in the "Assign..." list to "Delete Word Begin" and select it. Then click on Assign Feature to Key.
    • Repeat the process for the "delete the next word" feature, using <Right+Ctrl+Alt> and "Delete Word." (Not "Delete Word End," since that just deletes remaining letters in the current word.)
    • Click OK when you are finished, then Close.

When you press one of these key conbinations (e.g., <Ctrl+Alt+LeftArrow>) repeatedly, you can delete consecutive words at the cursor location (assuming there are no format or other codes present).

[Thanks to Wolfgang Deiminger for posting this tip in the public Corel newsgroup.]

Page Top

Advanced users

"Double-key" or "double-strike" macros are macros that are played by two consecutive presses of an alphanumeric key, and can be constructed using the following format. They can be useful to quickly play a favorite macro or one that must be played multiple times to process some text.

You should note, however, that most alphanumeric keys are not very good candidates to use to play a macro this way, since there are many letters and numbers that might appear twice in a particular word or number. You could use upper case (by pressing the <Shift> key), but some might find this awkward. The best cadidates probably are the ` key, the = key, and the backslash or backstroke key (\). (You can also use the <Insert> key if you reassign the Typeover function to another key combination.)

Example:  

Suppose you want to use the ` key (to the left of the 1 key on most keyboards) to play a macro that (1) deletes all multiple spaces at the cursor location and (2) replaces them with a tab -- but you also want to use this key to type a ` character when needed. The structure below will do the job. Save it in your macros folder, then assign it to the ` key using the procedure described above. (The ` key is located just above the left brace ( { ) in the shortcut list when you check the "Allow assignment of character keys" checkbox.).

Thereafter, pressing the ` key once will type a ` character, as usual. Pressing it twice consecutively will cause the first ` characer to be "seen" by the macro on the left of the cursor, whereupon it will delete it and play the working part of the macro (i.e., convert the spaces to a tab) instead of simply typing another ` character.

// Macro begins here -
If (?LeftChar="`")  // if a ` character is on the left -
   DeleteCharPrevious  // - delete the character

    // The "working" part of the macro begins here -
    vCount:=0 // - initialize a counter
    // While the left character is a space, move to the left -
    While (?LeftChar=" ")
         PosCharPrevious
    Endwhile
    SelectMode (On!) // - start selecting text
    // While the right character is a space, move right -
    While (?RightChar=" ")
         PosCharNext
         vCount:=vCount+1 // - increment counter
    Endwhile
    // If there's more than one space, delete all of them - 
    If (vCount>1)
         SelectDelete
         Tab  // - then insert a Left Tab
    Else
         SelectMode (Off!) // - turn select mode off
    Endif
    // The "working" part of the macro ends here

Else
         Type ("`") // - type a ` character
Endif
Quit
// Macro ends here

Notes

You can directly download this macro as 2Key-S2T.zip. It also contains optional code to search for all multiple spaces and replace them with tabs; you can use this code as a standalone macro.

You can create "triple-strike" or even "quadruple-strike" macros by having the macro assigned to the alphanumeric key check the number of instances of that character that appear to the left of the last instance. If (for a triple-strike macro) the character appears two times, then the third press of the key would cause the two characters to be deleted and the macro to execute other commands. This approach increases the number of ordinary alphanumeric keys that might make good candidates to use to play such a macro. See "Make a key do 'double duty'..." for examples.

Page Top