Le Menu

Le Menu

by Kendall Callas

I remember my visit to France, years ago. We were in love and so was Paris. Hand in hand with my goddess in sensible shoes, we walked the streets for hours to marvel at the Louvre, the Eiffel Tower, the grand avenues, and so much more.

Our eyes so happy, our feet so tired, we landed at a Parisian bistro sparkling with ambiance and shiny brass. The menu was long, the descriptions terse -- and it was in French! But our suave waiter soon rescued us by offering a short list, in English, and our happiness was complete.

Ever since then I have valued the "Less is More" approach. Simple English, briefly stated.

As a WordPerfect consultant and Certified Instructor, I've implemented this idea for several San Francisco law firms in a WordPerfect 5.1 macro called MENU, presented here. MENU lets you create your own short descriptive list of macros and form documents. It was originally created to facilitate use of "fill-in-the-blank" forms, but you'll find it amazingly flexible.

I think of MENU as a "task launcher". That is, it allows you to quickly and simply choose a task from a menu, point-and-shoot style. What's a task? A task is a file that you have previously created for re-use: a macro, a merge document (primary file), or a template document ("boilerplate").

Why use MENU?

  1. Easy to use "point-and-shoot" style.
  2. Tasks are chosen from a list which can be grouped logically or according to some sequence.
  3. Users don't have to remember names of files or their directory locations -- or spend time navigating.
  4. Users won't have to figure out which tasks are macros or merges, or how to start them
  5. .
  6. Macros can be listed with descriptions (a feature not otherwise available in any version of WordPerfect), so a printed macro cheatsheet is no longer necessary.
  7. The risk of over-writing your template or form documents is removed.
  8. As your needs change, you won't need to edit the macro code; to add or modify tasks, you'll edit the Index file which is an ordinary WordPerfect document.


MENU shows you a list of tasks -- your tasks. So to use the macro, you must first create the list: Type a list of your macros and forms into an ordinary WordPerfect document; save it to the name Index. Type filenames on the left, descriptions on the right. Specifically, type a complete filename including directory path at the left edge of a line (for example, "C:\FORMS\LETTER.FMT"), press the Tab key (as many times as you like), then type a description (such as "Correspondence format") -- as long as necessary.

The filename is key, it must be first on the line, immediately followed by the Tab key -- the Tab code is a marker that terminates the filename. Don't use the Tab key within the task descriptions.

Imaginative formatting is okay. I like to type my filenames in bold caps, then Tab, Indent, and the description. To dress up your Index further, you may include tab settings, headings, underline, Indent (F4), etc. Organize large lists into screens; perhaps use Ctrl+Enter to insert page divisions so that PgUp and PgDn work effectively. I like to place the words "- More Below -" at the bottom of each screen.


A law office might use an Index file that begins something like this:

    c:\forms\LETTER.fmt      Letter format
    c:\forms\MEMO.fmt        Memo format
    c:\forms\PLEAD28.fmt     Pleading format - 28 line pleading paper
    c:\forms\PLEAD26.fmt     Pleading format - 26 line pleading paper
    c:\forms\PLEADUS.fmt     Pleading format - USDC

    ENVELOPE.wpm             Format and print envelope from address on-screen
    c:\forms\FAXCOVER.wpm    FAX cover sheet
    c:\forms\POS.mrg         Proof of Service

    c:\jcf\982a5.jcf         Request for Dismissal - Judicial Council Form
    c:\wp\variable.JIM       Define Jim's variables Alt+1, Alt+2, Alt+3 ... 
    c:\wp\variable.TOM       Define Tom's variables Alt+1, Alt+2, Alt+3 ... 

    d:\complain\ANSWER1      Answer to Verified Complaint
    d:\discovry\ROG.mrg      Preface paragraphs to Interrogatories

A small business person might create an Index file like this:

    c:\promo\Sales.ltr       Solicitation letter for prospective clients
    c:\dtp\Fees              Rate sheet
    c:\client\Proposal.fmt   Format for new client proposal

    c:\forms\Invoice.fmt     Format for invoice
    c:\forms\Collect.ltr     Past due notice

    c:\hire\HelpWant.ad      Job available newspaper advertisement
    c:\hire\Descrip.job      Basic job description
    c:\hire\NewHire.mmo      Orientation memo for new employee
    c:\hire\Fire.mmo         Employee dismissal memo

    c:\rent\ForRent          Apartment-for-rent newspaper advertisement
    c:\contract\Rental.con   Rental contract
    c:\rent\Tenant.new       New tenant orientation letter 
    c:\rent\Rent.up          Rental increase notice
    c:\rent\Deposit.int      Rental deposit interest transmittal letter
    c:\rent\Eviction         Eviction notice


A typical office should include form letters, boilerplate documents, and a format file for each type of document commonly produced, such as letters, memos, pleadings, agreements, reports, labels, etc. Format files typically include the codes to initialize margins, tab settings, fonts, paper size/type, page numbering, headers, footers, etc. A letter format might even include the fonts and text to typeset the firm name and address.

The {DATE} merge code and {KEYBOARD} 'stop code' are frequently useful. [These merge codes and those below are placed with the Merge Codes key (Shift+F9), (6) More.] Here's an example of the contents for a memo format file:

                              M E M O R A N D U M

To:         {BELL}{KEYBOARD}

From:       {BELL}{KEYBOARD}

Date:       {DATE}

Subject:    {BELL}{KEYBOARD}


More sophisticated merge documents might use the {NEST MACRO}macroname~ command to embed a macro within a document, {NEST PRIMARY}filename~ to retrieve a file, or {NEST SECONDARY}datafile~ (followed by {FIELD} codes) to use fields from a mailing list or client profile.


One powerful task you might include in your Index file is to define the Alt+# variables. Did you know that you can define the Alt+# keystrokes to type out your own standard phrases? Perhaps your name, address, and phone number are snippets of text that you frequently repeat. You could use Alt+1 and Alt+2 and Alt+3 to retrieve these pieces of information for you.

You can define the ten number variables, 1, 2, 3, 4, 5, 6, 7, 8, 9 and 0 for access with the Alt key. They can contain phrases up to 128 characters long, text only -- no codes.

To define variables, create a primary merge file such as VARIABLE.TOM (referred to above in the law firm's Index), which would look like this:
{ASSIGN}1~Thomas J. DeVries, Esq.~{COMMENT}
~{ASSIGN}3~(State Bar # 123456)~{COMMENT}
~{ASSIGN}5~123 Montgomery Street, Suite 600, San Francisco, California 94111~{COMMENT}
~{ASSIGN}6~Telephone: (415) 987-6543 Fax: (415) 987-6555~{COMMENT}
~{ASSIGN}7~San Francisco Superior Court Action Number ~{COMMENT}
~{ASSIGN}8~I declare under penalty of perjury under the laws of the State of California that the foregoing is true and correct.~{COMMENT}
~{ASSIGN}9~My office is located on Montgomery Street between Sutter and Bush. Parking is available across the street.~{COMMENT}
~{ASSIGN}0~After our prearbitration meeting on XX, 1994, we will travel together to the arbitration. I look forward to meeting you.~

[The {ASSIGN} and {COMMENT} merge codes are placed with the Merge Codes key (Shift+F9), (6) More. Watch those tilde (~) symbols!]

You might create a set of ten Alt+# variables for each user, author, or task, as shown, or you might create a set for each client by placing a file (named something like CLIENT.DTA) in each of your client directories. The Index file entry would look like this (note no directory path):

    CLIENT.DTA   Define variables Alt+1, Alt+2, Alt+3 ... for current client directory


Use the Macro Editor to type in the macro shown in Figure 1. (Any version of WordPerfect 5.1 will do.) To enter directly into the Macro Editor, begin with the (Home) key. Press Macro Define (Ctrl+F10) then enter the name of the macro. At the Define macro: type the name menu then press Enter, or for faster use name it Alt+M instead by holding down the Alt key and pressing the letter M. Answer the Description: prompt by typing something like Task launcher, then press Enter. Press the (Delete) key to remove the {DISPLAY OFF} code WordPerfect automatically adds to start things off.

Use the Macro Commands pick list (Ctrl+PgUp) to enter commands like {ASSIGN} and {STATE}.

Notice some of the keys you'll need to record into the macro: {Home}, {Up}, {Enter}, {Esc}, {Exit}, and {Macro Commands}. Create these codes by beginning with Ctrl+V (to enter a key Value), then press the key. For example, to enter the {Home} code, use Ctrl+V then press the Home key. For {Esc}, use Ctrl+V, then (Escape). For {Macro Commands}, use Ctrl+V, then (Ctrl+PgUp).

When you're done typing in the macro, press Exit (F7) to save and quit.


From a blank screen, use the Macro key (Alt+F10) to start the macro. At the Macro: prompt, type menu and press Enter. (If you named this macro Alt+M, you can start it from a blank screen simply by holding down the Alt key and pressing the letter M.)

Shortly, your Index file will be displayed. Use the arrow keys to point to the task you wish to launch, then press Enter. You may also use Home key movements or PgDn/PgUp -- any movement is okay. As indicated by the prompt at the bottom left of the screen, you may also use WordPerfect's Search (F2) feature to locate tasks far down the list.


The first two lines allow you to tailor two of the macro's assumptions, the Index filename and the key that marks the end of the filenames in the Index file.

On line 1, specify the complete directory path and filename of your Index file. (Network administrators may provide an individualized Index file for each user by specifying the location of the Index file in the user home directory, such as "H:INDEX".)

On line 2, place the {Tab} code with Ctrl+V then press the Tab key. Optionally, you may use the {Indent} key; place it by simply pressing F4 -- if you do so, make sure to use Indent/F4 to terminate the filenames in your Index file.

Lines 5 - 7 make sure some variables used later have not been previously assigned.

Line 8 makes sure that a failed search (with F2) doesn't bomb the macro.

Lines 9 - 12 set the stage, assuring that the macro begins at the edit screen and not in a sub-edit screen like header/footer or a footnote. If Block or Reveal Codes is on, it's turned off.

Line 13 tests to make sure that you're beginning with an empty document. If not, you're warned and given a choice. You'll want to remove lines 13 through 18 if you wish to use this macro to assemble documents by adding boilerplate paragraphs.

Line 19 tells the macro to use the Cancel subroutine if you press Cancel (F1).

Line 21 is important; the macro must respond intelligently if, in the next line, it can't find the Index file which you specified on line 1. The {ON ERROR} statement will invoke the Error subroutine (line 73) if the file can't be located.

Line 22 is the first main step. It merges onto your screen the Index file you previously prepared and have specified on line 1. Merge is used (instead of Retrieve) to avoid any possible damage to the Index file (if an error is encountered, the macro may abort and leave the Index file on the screen -- wouldn't want a user to inadvertently alter it then save it.

Line 23 simply resets the {ON ERROR} statement from line 21 so that some other problem doesn't trigger the Error subroutine.

Line 25 moves the cursor to the top of the Index document (which may be many screens).

Line 26 uses {STATUS PROMPT} to fix this prompt at the bottom of the screen:
Search/F2 or v point ^ to filename then [Enter]

Two control codes, {^]} and {^\}, are used to selectively bold key words in the prompt. To turn bold on, place the {^]} code by holding down the Ctrl key as you press the ] right bracket symbol. So, that's Ctrl+] to turn bold on; Ctrl+\ (backslash) turns bold off.

The up and down arrow symbols are created using the Compose feature (Ctrl+2). Place the down arrow with Ctrl+2, then type 6,24 (six, comma, twenty-four) and press Enter. Place the up arrow with Ctrl+2, type 6,23 (six, comma, twenty-three) and press Enter.

Lines 28 - 35 use a {WHILE} statement to set up a permanent loop. As the user peruses the Index file on-screen, these lines wait for a keystroke, then analyze it to see if it was the Enter, ESCape, or Exit key that was pressed; if not, the keystroke is passed through (line 34) and the loop continues, allowing the user to roam the Index file using almost any keystrokes. For example, if the user presses PgDn, WordPerfect acts on it. But if Enter is pressed, the macro breaks out of the loop and picks up again on line 36. If either the Exit or ESCape key is pressed, the Cancel subroutine is invoked (line 68).

Line 36 clears the prompt set on line 26.

Lines 37 - 42 try to assure that conditions are right to continue after the user has pressed Enter. There is a risk here that during the {WHILE} loop above, the Search (F2) feature was terminated incorrectly (with Enter instead of F2). So line 37 checks to assure that its at an edit screen (and not in the middle of Search or List Files). If somehow the user got into a header/footer or graphic box edit screen (with Extended Search), it's handled with Exit; otherwise, the Cancel key is pressed on line 39 (most likely to abort Search). If there was a problem, line 41 starts things over on line 24.

Line 43 zips the cursor to the right edge of the screen to setup for the next line. Line 44 then searches backwards (left) to locate the filename marker (Tab) set on line 2. Line 45 jockeys to the left edge of the line. Line 46 then turns on block, stretches the highlighting to the Tab marker, then steps left to exclude the Tab marker. Line 47 assigns the blocked text (filename) to the variable ENTRY.

Line 48 performs a rudimentary test to help avoid a bad selection (filename of 0, 1, or 2 characters) due to a misplaced Tab.

At line 49, all is well and selection was successful, so the Index is cleared from the screen.

Lines 50 - 54 begin the surprisingly hard work of identifying whether or not the selected entry was a macro. To check for a ".WPM" extension, these lines test if each character of the filename is a period, indicating a filename extension. If a period is found, the macro does some math to determine the position at which the extension begins. If an extension was found, line 56 determines its length (usually 3 characters, of course). Line 57 then assigns the actual characters of the filename extension to the variable EXT for use below on line 60.

Line 59 sets up for failure (just like line 21). If the macro can't find the file the user selected, it will invoke the Notfound subroutine.

Line 60 tests if the file selected was a macro (the telltale ".wpm" or ".WPM" extension). If so, line 61 calls that macro and line 62 terminates the MENU macro.

If the selected file was not a macro, however, line 64 fires the big guns. This line is the heart of the MENU macro. It treats the file selected as a merge document -- a primary file -- with no secondary (data) file. This serves the purpose of retrieving the file minus the filename (to avoid risk of over-writing the original) and, of course, processes any merge codes or nested macros.

Lastly, line 65 relocates the cursor to the top of the document now on-screen.

Below line 67 are the subroutines that handle the 3 likely error conditions; Cancel responds if the user presses F1 or ESCape or Exit (F7), Error responds if the Index file is not available, and Notfound responds if the selected file is not available. Mainly, they sound an alarm {BELL}, clear the prompt set on line 26, and (on lines 75 and 83) use the Cancel key to abort a failed merge.

Note the {CHAR} commands on lines 77 and 85. The usefulness of these error messages is improved by notifying the user of the culprit -- which file could not be found. The user is assured enough time to read the message because the {CHAR} command waits for a key to be pressed. Blinking text is used to attract attention to the error message with these codes: {^N}{^P}Press a key{^O}{^P} {^N}{^P} turns blinking on and {^O}{^P} turns blinking off. As described for line 26, place these control codes with Ctrl+letter, such as Ctrl+N to create the {^N} code.



3  {;}------------------------------------------------------------------
4  MENU.WPM  Task launcher by Kendall Callas  (C) Copyright 1994 ~


9  {IF}!{STATE}&4~{BELL}{QUIT}{END IF}    {;}not at edit screen~
10 {IF}{STATE}&8~{BELL}{QUIT}{END IF}     {;}not main edit screen~
11 {IF}{STATE}&128~{Block}{END IF}        {;}turn block off~
12 {IF}{STATE}&512~{Reveal Codes}{END IF} {;}reveal codes off~

13 {IF}!{SYSTEM}document~&256~{BELL}      {;}if doc not empty, clear first~
14    {CHAR}x~Screen not empty!  Clear screen and continue? (Y/N) Y{Left}~
15    {IF}"{VARIABLE}x~"="n"|"{VARIABLE}x~"="N"~{QUIT}
16      {ELSE}{Exit}NN
17    {END IF}
18 {END IF}

19 {ON CANCEL}{GO}Cancel~~

20 {LABEL}getIndex~                       {;}retrieve Index file~
21 {ON ERROR}{GO}Error~~
22 {Merge/Sort}M{VARIABLE}INDEX~{Enter}{Enter}
23 {ON ERROR}~
24 {LABEL}point~
25 {Home}{Home}{Up}
26 {STATUS PROMPT}{^]}Search/F2{^\} or {^]}v point ^{^\} to filename then

28 {WHILE}1~                              {;}wait for Enter or ESCape~
29    {LOOK}KEY~
30    {IF}"{VARIABLE}KEY~"="{Enter}"~{BREAK}{END IF}
31    {IF}"{VARIABLE}KEY~"="{Esc}"|"{VARIABLE}KEY~"="{Exit}"~
32       {GO}Cancel~
33    {END IF}

37 {IF}!{STATE}&4~{BELL}               {;}not at edit screen - maybe search~
38    {IF}{STATE}&8~{Exit}             {;}in special edit screen~
39    {ELSE}{Cancel}
40    {END IF}
41 {GO}point~
42 {END IF}

43 {Home}{Right}                       {;}highlight selected file~
44 {Search Left}{VARIABLE}ENDMARK~{Search}
45 {Home}{Home}{Left}
46 {Block}{Search}{VARIABLE}ENDMARK~{Search}{Left}
47 {Macro Commands}aENTRY{Enter}       {;}assign filename to ENTRY variable~
48 {IF}{LEN}ENTRY~<3~{BELL}{GO}point~{END IF}
49 {Exit}NN                            {;}clear screen~
50 {FOR}COUNTER~0~{LEN}ENTRY~-1~1~     {;}test for extension~
51    {IF}"{MID}ENTRY~{VARIABLE}COUNTER~~1~"="."~  {;}note period~
53    {END IF}
54 {END FOR}

55 {IF}{VARIABLE}OFFSET~>0~            {;}assign extension if any to EXT~
58 {END IF}

59 {ON ERROR}{GO}Notfound~~
61    {NEST}{VARIABLE}ENTRY~~          {;}launch macro~
62    {QUIT}
63 {END IF}

64 {Merge/Sort}M{VARIABLE}ENTRY~{Enter}{Enter}   {;}merge file~
65 {Home}{Home}{Up}
66 {QUIT}

67 {;}---------------------SUBROUTINES---------------------------------~
68 {LABEL}Cancel~                      {;}user pressed F1, Esc, or Exit~
69 {BELL}
71 {Exit}NN
72 {QUIT}

73 {LABEL}Error~                       {;}unable to retrieve Index file~
75 {Cancel}
77 {CHAR}x~Aborting -- {VARIABLE}INDEX~ file not found!  {^N}{^P}Press a
78 {QUIT}

80 {LABEL}Notfound~                    {;}unable to launch requested file~
81 {BELL}
83 {ELSE}{Cancel}                      {;}if not a macro, cancel merge~
84 {END IF}
85 {CHAR}x~Aborting -- {VARIABLE}ENTRY~ not found!  {^N}{^P}Press a
86 {GO}getIndex~

Copyright (C) 1995 by microCounsel, (415) 921-6850. All rights reserved.

[ Home Page | Articles List | Top of this article ]