Top Navigational Bar

Macros - Variable Training
DocumentID: 652809
Revision Date: 29-Feb-96 8:29:18 PM

The information in this document applies to:
WordPerfect® 5.1 for DOS

Problem

Solutions: VARIABLE - is like a container
      macros let you do the following:
      - name the container
      - fill the container
      - empty the container
      - look inside the container

SYNTAX      {ASSIGN}var~expr~
             var~ - gives the container a name
             expr~ - is the object to be placed inside the container

CREATION      Home, Macro Define (Ctrl-F10), ALTA
      Use Home to go directly to macro edit.
      {ASSIGN}1~your name~
      {ASSIGN}2~any number from 1 to 3~
            use Alt-1, and Alt-2 to manually display contents of variables on main screen


{VARIABLE}#~
      {VAR #}      lets the macro display the contents of variables on the main screen
      use Ctrl-V, # to get {VAR #}
            use the window to get {VARIABLE}#~ - this must be used if the variable's name is not a single digit number


            Attributes                                    Syntax
Assign      Places information in variable      {ASSIGN}var~ex pr~
Text            Allows user input; up to 129
            characters are placed in variable      {TEXT}var~mess age~
Character      Allows user input; only 1
            character is placed in variable      {CHAR}var~mess age~


=====================================================================
Howdy {VARIABLE}1~, you choose {VAR #} as your number. Mingle text with variables

{CASE}var~case1~label1...caseN~labelN~~
{LABEL}1~...
{LABEL}N~
adds decision making and branching to the macro
{ASSIGN}1~YOUR NAME~
{ASSIGN}2~#~
{ASSIGN}1~YOUR NAME~
{ASSIGN}2~#~


{VARIABLE}1~, {VAR 2}
{ASSIGN}1~~
{ASSIGN}2~~

{TEXT}1~What is your name: ~
{CHAR}2~Please enter a number from 1 to 3: ~

{VARIABLE}1~, {VAR 2}
{ASSIGN}1~~
{ASSIGN}2~~

{TEXT}1~What is your name: ~
{CHAR}2~Please enter a number from 1 to 3: ~

Howdy {VARIABLE}1~, you chose {VAR 2} as your number.
{ASSIGN}1~~
{ASSIGN}2~~


{TEXT}1~What is your name: ~

{LABEL}choice~
{CHAR}2~Please enter a number from 1 to 3: ~
{CASE}{VARIABLE}2~~
      1~lonely~
      2~company~
      3~crowd~
      {ELSE}~wrong~~

{LABEL}lonely~
      {ASSIGN}comment~which is the loneliest number~
      {GO}statement~
{LABEL}company~
      {ASSIGN}comment~which is company~
      {GO}statement~
{LABEL}crowd~
      {ASSIGN}comment~which is a crowd~
      {GO}statement~
{LABEL}wrong~
      {PROMPT}you chose {VAR 2}, which is not between 1 and 3.~
      {WAIT}40~
      {GO}choice~

{LABEL}statement~
Howdy {VARIABLE}1~, you chose {VAR 2} as your number, {VARIABLE}comment~.

Answer:

Details:


Product specifications, packaging, technical support and information (*Specifications*) refer to theUnited States retail English version only. Specifications for other versions may vary. All Specifications, claims, features, representations, and/or comparisons provided are correct to the best of our knowledge of the date of publication, but are subject to change without notice.OUR MAXIMUM AGGREGATE LIABILITY TO YOU AND THAT OF OUR DEALERS AND SUPPLIERS IS LIMITED. IT SHALL NOTEXCEED THE AMOUNT YOU PAID TO ACCESS THE INFORMATION. SEE LEGAL DISCLAIMER.