home *** CD-ROM | disk | FTP | other *** search
/ High Voltage Shareware / high1.zip / high1 / DIR8 / WP60DOSM.ZIP / PROGRAM.ASC < prev    next >
Text File  |  1993-09-22  |  163KB  |  4,953 lines

  1. Programming Commands Index
  2.  
  3. ───────────────────────────────────────────────────────────────
  4.  A-C
  5. ───────
  6. // (Comment)
  7. AND
  8. ASSERT
  9. ASSIGN
  10. BEEP
  11. BREAK
  12. CALL
  13. CANCEL
  14. CASEOF
  15. CHAIN
  16. CHAR
  17. CONTINUE
  18. CTON
  19.  
  20.  D-F
  21. ───────
  22. DEFAULT
  23. DEFAULTUNITS
  24. DISCARD
  25. DISPLAY
  26. DIV
  27. ELSE
  28. ENDFOR
  29. ENDFUNC
  30. ENDIF
  31. ENDPROC
  32. ENDSWITCH
  33. ENDWHILE
  34. ERROR
  35. EXISTS
  36. FOREACH
  37. FORNEXT
  38. FRACTION
  39. FUNCTION
  40.  
  41.  G-O
  42. ───────
  43. GETNUMBER
  44. GETSTRING
  45. GETUNITS
  46. GLOBAL
  47. GO
  48. IF
  49. INDIRECT
  50. INPUT
  51. INTEGER
  52. LABEL
  53. LOCAL
  54. LOOK
  55. MENULIST
  56. NEST
  57. NEXT
  58. NOT
  59. NOTFOUND
  60. NTOC
  61. NUMSTR
  62. ONCANCEL
  63. ONERROR
  64. ONNOTFOUND
  65. OR
  66.  
  67.  P-R
  68. ───────
  69. PAUSE
  70. PAUSECOMMAND
  71. PAUSEKEY
  72. PAUSESET
  73. PERSIST
  74. PERSISTALL
  75. PRESSKEY
  76. PROCEDURE
  77. PRODUCT
  78. PROMPT
  79. QUIT
  80. REPEAT
  81. RETURN
  82. RUNUNATTENDED
  83.  
  84.  S
  85. ───────
  86. SAVESTATE
  87. SHELLASSIGN
  88. SHELLMACRO
  89. SHELLVARIABLE
  90. SHOWATTROFF
  91. SHOWATTRON
  92. SHOWCODE
  93. SHOWCOLOR
  94. SHOWPOSITION
  95. SHOWTEXT
  96. SPEED
  97. STATUSPROMPT
  98. STEP
  99. STRLEN
  100. STRNUM
  101. STRPOS
  102. STRUNIT
  103. SUBSTR
  104. SWITCH
  105.  
  106.  T-Z
  107. ───────
  108. TOLOWER
  109. TOUPPER
  110. UNITSTR
  111. UNTIL
  112. USE
  113. USERFUNCTION
  114. VARERRCHK
  115. WAIT
  116. WHILE
  117. XOR
  118. //
  119.  
  120. Show Me An Example...
  121. ─────────────────────────────────────────────────────────────────
  122. Comment (//) reserves text between the Comment command (//) and
  123. the next hard return (Hrt) as comments.  Anything reserved as a
  124. comment will be ignored by the macro.  Comments are used to
  125. document a macro without affecting it's execution.
  126.  
  127. Syntax:        // Comments [Hrt]
  128.  
  129. Parameters:    Comments
  130.                A character expression or a numeric expression
  131.  
  132.                              ────  ──── For Example...
  133.  
  134. This macro retrieves and prints all documents in the default
  135. directory.
  136.  
  137. DISPLAY(On!)
  138. DLGInput(on!)     // allows keystrokes to be sent to a dialog box
  139. FileManagerDlg
  140. HardReturn
  141. DownArrow
  142. tot:=?List-2
  143. Cancelkey
  144. cnt:=1
  145. WHILE(tot<>cnt)
  146.   FileManagerDlg
  147.   FileManagerDlg
  148.   DownArrow
  149.   type("1")       //opens the highlighted document
  150.   PrintFullDoc
  151.   ExitDlg
  152.   Type("nn")      //"No" to save and "No" to exit WordPerfect
  153.   cnt:=cnt+1
  154. ENDWHILE
  155. AND
  156.  
  157. Show Me An Example...
  158. ─────────────────────────────────────────────────────────────────
  159. AND is an operator that evaluates two expressions, usually in a
  160. conditional statement.  Conditional statements can be created
  161. with commands such as IF, REPEAT, and WHILE.  This operator
  162. performs a logical AND that evaluates a conditional statement as
  163. true only if both the expressions are true.
  164.  
  165. Parameters:    None
  166.  
  167. See Also:      DIV
  168.                IF
  169.                NOT
  170.                OR
  171.                REPEAT
  172.                WHILE
  173.                XOR
  174.                              ────  ──── For Example...
  175.  
  176. This macro counts keystrokes until the user presses Ctrl-Enter.
  177.  
  178. STATUSPROMPT("Press Ctrl+Enter to quit")
  179. cnt:=0
  180. REPEAT
  181.   LOOK(info)
  182.   IF((info<>0) AND (info<>-8097))
  183.     cnt:=cnt+1
  184.     Type(NTOC(info))
  185.   ENDIF
  186. UNTIL(info=-8097)
  187. STATUSPROMPT("")
  188. PAUSESET(EndFieldKey)
  189. PROMPT("You pressed "+cnt+" keystrokes.  Press F9 to continue")
  190. PAUSE
  191. ASSERT
  192.  
  193. Show Me An Example...
  194. ─────────────────────────────────────────────────────────────────
  195. ASSERT causes a macro to respond as if one of three conditions
  196. exists.  This command can assert (or cause) an Error, a Cancel,
  197. or a Not Found condition.  Each of these conditions can be used
  198. to end a macro or redirect macro flow.  To redirect the flow of a
  199. macro to a specific LABEL, you can use ONCANCEL, ONERROR, or
  200. ONNOTFOUND.  A macro will stop if it has not encountered one of
  201. these commands before the corresponding condition has been
  202. asserted.  ASSERT will have no effect if a CANCEL, ERROR, or
  203. NOTFOUND command has been used before the ASSERT command to
  204. disable detection of these conditions.
  205.  
  206.  
  207. Syntax:        ASSERT(Condition)
  208.  
  209. Parameters:    Condition
  210.                Specifies the condition to assert.  Select an
  211.                enumerated type or its numeric equivalent.
  212.  
  213.  
  214.                Enumerated           Numeric        Description
  215.                Type                 Equivalent
  216.                ═════════════════════════════════════════════════
  217.                CancelCondition!     0              Asserts a
  218.                                                    Cancel 
  219.                ErrorCondition!      1              Asserts an
  220.                                                    Error 
  221.                NotFoundCondition!   2              Asserts a Not
  222.                                                    Found
  223.                ═════════════════════════════════════════════════
  224.  
  225. See Also:      NotFound
  226.                CANCEL
  227.                ERROR
  228.                LABEL
  229.                NOTFOUND
  230.                ONCANCEL
  231.                ONERROR
  232.                ONNOTFOUND
  233.                              ────  ──── For Example...
  234.  
  235. This macro prompts the user to highlight text in a document, and
  236. the macro assigns it to a variable.
  237.  
  238. Display(On!)
  239. ONERROR(error)
  240. LABEL(Begin)
  241. BlockKey
  242. PROMPT("Highlight the text to assign to a variable and press
  243. Enter")
  244. PAUSE
  245. x:=?BlockedText
  246.  
  247. IF (x="")
  248.   ASSERT(ErrorCondition!)
  249. ENDIF
  250.             //the user must place more code here to make
  251. QUIT           //this macro more functional
  252.  
  253. LABEL(Error)
  254. BEEP
  255. DisplayRewrite
  256. PROMPT("You must select text to assign it to a variable")
  257. PAUSE
  258. GO(Begin)
  259. ASSIGN
  260.  
  261. Show Me An Example...
  262. ─────────────────────────────────────────────────────────────────
  263. ASSIGN places a value in a WordPerfect variable.  The values can
  264. be a numeric expression, measurement expression, character
  265. expression, or other variables.  Consider the following examples:
  266.  
  267.    ASSIGN (PERIOD; "Renaissance")
  268.  
  269. This ASSIGN statement assigns the word "Renaissance" to variable
  270. PERIOD.  Note the quotation marks around the character
  271. expression.
  272.  
  273.    ASSIGN (SUM; NUMBER+19)
  274.  
  275. This ASSIGN statement assigns 19 plus the value of the variable
  276. NUMBER to the variable SUM.  For example, if variable NUMBER is
  277. 10, variable SUM will be assigned the value of 29.
  278.  
  279.  
  280. Syntax:        ASSIGN (Variable; Expression)
  281.                or
  282.                Variable=Expression
  283.                or
  284.                Variable:=Expression
  285.  
  286. Parameters:    Variable
  287.                Any variable less than 29 characters in length can
  288.                be used in this parameter.
  289.  
  290.                Expression
  291.                All expressions, including variables, can be used
  292.                in this parameter.
  293.  
  294. See Also:      DISCARD
  295.                GLOBAL
  296.                INDIRECT
  297.                LOCAL
  298.                PERSIST
  299.                PERSISTALL
  300.                SHELLASSIGN
  301.                SHELLVARIABLE
  302.                              ────  ──── For Example...
  303.  
  304. This macro creates a secondary merge file through a series of
  305. prompts.
  306.  
  307. ASSIGN(More;"Y")
  308. WHILE(TOUPPER(More)="Y")
  309.    FOREACH(field;{"First Name";"Last 
  310.       Name";"Company";"Address";"City";"State";"Zip"})
  311.       GETSTRING(info;"Enter the "+field;"Field "+field;)
  312.       TYPE(info)
  313.       EndField
  314.       info:=""
  315.    ENDFOR
  316.    MergeCode(EndRecord!)
  317.    CHAR(More;"Enter another record? Y/N")
  318.    ASSIGN(More;NTOC(More))
  319. ENDWHILE
  320. BEEP
  321.  
  322. Show Me An Example...
  323. ─────────────────────────────────────────────────────────────────
  324. The computer beeps when this command is executed.  BEEP is often
  325. used to prompt the user when a macro pauses or displays a
  326. message.
  327.  
  328. Syntax:        BEEP
  329.  
  330. Parameters:    None
  331.  
  332. See Also:      ONCANCEL
  333.                ONERROR
  334.                ONNOTFOUND
  335.                PAUSE
  336.                PROMPT
  337.                              ────  ──── For Example...
  338.  
  339. This macro beeps if the current document is blank and displays a
  340. message.
  341.  
  342. DISPLAY(Off!)
  343. IF(?DocBlank)
  344.    BEEP
  345.    DISPLAY(On!)
  346.    PROMPT("The document is blank.  Press Tab to continue")
  347.    PAUSEKEY(TabKey)
  348.    DISPLAY(Off!)
  349.    QUIT
  350. ENDIF
  351. BREAK
  352.  
  353. Show Me An Example...
  354. ─────────────────────────────────────────────────────────────────
  355. BREAK breaks out of loops or statements created with SWITCH,
  356. FORNEXT, REPEAT, or WHILE commands.  At the point this command is
  357. encountered, the macro is redirected to the end of the loop or
  358. statement, and resumes execution.  For example, if this command
  359. breaks out of a WHILE loop, the macro is redirected to the
  360. command immediately following the ENDWHILE command and continues
  361. from that point.
  362.  
  363. Syntax:        BREAK
  364.  
  365. Parameters:    None
  366.  
  367. See Also:      SWITCH
  368.                FORNEXT
  369.                FOREACH
  370.                NEXT
  371.                REPEAT
  372.                WHILE
  373.                              ────  ──── For Example...
  374.  
  375. This macro counts from one to ten and breaks out of the loop when
  376. it reaches the number seven.
  377.  
  378. DISPLAY(Off!)
  379. FORNEXT(x;1;9;1)
  380.    Type(x)
  381.    IF(x=7)
  382.       BREAK
  383.    ENDIF
  384. ENDFOR
  385. CALL
  386.  
  387. Show Me An Example...
  388. ─────────────────────────────────────────────────────────────────
  389. The CALL command redirects macro execution to the LABEL command
  390. specified in the Label parameter.  The macro executes from that
  391. point until it encounters a RETURN command.  Macro execution then
  392. returns to the command immediately following the CALL command and
  393. resumes from that point.  This command is useful for repeating a
  394. subroutine from any location in the macro.
  395.  
  396. Syntax:        CALL(Label)
  397.  
  398. Parameters:    Label
  399.                Any combination of text can specify the label. 
  400.                The label name used here must correspond to a
  401.                LABEL command in the same macro.
  402.  
  403. See Also:      LABEL
  404.                RETURN
  405.                              ────  ──── For Example...
  406.  
  407. This macro searches for a period (.) followed by two spaces and
  408. capitalizes the first letter of the next sentence.
  409.  
  410. DISPLAY(Off!)
  411. PosDocTop
  412. CALL(Convert)
  413.  
  414. ONNOTFOUND(NotFnd)
  415. LABEL(Begin)
  416. SearchString(".  ")
  417. SearchNext
  418. CALL(Convert)
  419. GO(Begin)
  420.  
  421. LABEL(Convert)
  422. BlockOn(CharMode!)
  423. PosCharNext
  424. ConvertCaseUppercase
  425. BlockOff
  426. RETURN
  427.  
  428. LABEL(NotFnd)
  429. DISPLAY(On!)
  430. PROMPT("It's finished.  Press ENTER to continue.")
  431. PAUSE
  432. PosDocTop
  433. CANCEL
  434.  
  435. Show Me An Example...
  436. ─────────────────────────────────────────────────────────────────
  437. CANCEL determines whether to ignore a Cancel condition while a
  438. macro is running.  A Cancel condition is created by pressing the
  439. Cancel key or by using the ASSERT(CancelCondition!) command.  By
  440. default, a Cancel condition is not ignored and will affect macro
  441. execution.  A Cancel will generally stop a macro, but it can also
  442. be used to redirect execution using ONCANCEL.  If an ONCANCEL
  443. command is encountered in the macro before a Cancel occurs, the
  444. macro is redirected to the LABEL specified in ONCANCEL.  Pressing
  445. Ctrl+Break always terminates a macro even if CANCEL(Off!) is
  446. used.
  447.  
  448. Syntax:        CANCEL(State)
  449.  
  450. Parameters:    State
  451.                Specifies whether to ignore cancel conditions. 
  452.                Select an enumerated type or its numeric
  453.                equivalent.
  454.  
  455.                Enumerated        Numeric        Description
  456.                Type              Equivalent
  457.                ═════════════════════════════════════════════════
  458.                Off!              0              Ignore Cancel
  459.                                                 conditions
  460.                On!               1              Do not ignore
  461.                                                 Cancel conditions
  462.                ═════════════════════════════════════════════════
  463.  
  464. See Also:      ASSERT
  465.                LABEL
  466.                ONCANCEL
  467.                              ────  ──── For Example...
  468.  
  469. This macro constantly prompts for a name until Cancel is pressed.
  470.  
  471. ONCANCEL CALL(Cancel)
  472. LABEL(Top)
  473. Name:=""
  474. GETSTRING(Name;"Type in a name, (Cancel or Enter) to
  475. quit";"Name")
  476. IF(Name="")
  477.    ASSERT(CancelCondition!)
  478. ENDIF
  479. TYPE(Name)
  480. HRt
  481. GO(Top)
  482.  
  483. LABEL(Cancel)
  484. CANCEL(Off!)
  485. CHAR(Selection;"Do you really want to Quit? Y/N")
  486. SWITCH(TOLOWER(NTOC(Selection)))
  487.    CASEOF "y" : QUIT
  488.    CASEOF "n" : CANCEL(On!) RETURN
  489.    DEFAULT    : GO(Cancel)
  490. ENDSWITCH
  491. CASEOF
  492.  
  493. Show Me An Example...
  494. ─────────────────────────────────────────────────────────────────
  495. CASEOF creates individual cases against which a single SWITCH
  496. expression is compared.  Each CASEOF can contain one or more
  497. expressions which, when evaluated individually, may be true, or
  498. in other words, provide a match for the SWITCH expression.  
  499.  
  500. For example, 
  501.  
  502. SWITCH(Year)
  503.    CASEOF 1776:
  504.       GO(Independence)
  505.    CASEOF 1988;1992:
  506.       GO(Elections)
  507. ENDSWITCH
  508.       
  509. The first CASEOF is true, or a match, if the SWITCH expression
  510. (variable Year) contains the number 1776.  The second CASEOF is a
  511. match if variable Year contains either 1988 or 1992.  In other
  512. words, if a CASEOF contains more than one expression, the semi-
  513. colon acts as an "or" rather than as an "and."  Both the SWITCH
  514. and the CASEOF expressions are case sensitive (capitalization)
  515. and must match exactly.  If a CASEOF match is found for the
  516. SWITCH expression, the commands immediately following that CASEOF
  517. will be executed and the macro does not evaluate any other CASEOF
  518. expression.  
  519.  
  520. Syntax:        CASEOF(Expression;Expression;...:)
  521.  
  522. Parameters:    Expression
  523.                Specifies the expression to evaluate.  All
  524.                expressions are valid for this parameter.
  525.  
  526. See Also:      SWITCH
  527.                CONTINUE
  528.                DEFAULT
  529.                ENDSWITCH
  530.                GO
  531.                              ────  ──── For Example...
  532.  
  533. This macro constantly prompts for a name until Cancel is pressed.
  534.  
  535. ONCANCEL CALL(Cancel)
  536. LABEL(Top)
  537. Name:=""
  538. GETSTRING(Name;"Type in a name, (Cancel or Enter) to
  539. quit";"Name")
  540. IF(Name="")
  541.    ASSERT(CancelCondition!)
  542. ENDIF
  543. TYPE(Name)
  544. HRt
  545. GO(Top)
  546.  
  547. LABEL(Cancel)
  548. CANCEL(Off!)
  549. CHAR(Selection;"Do you really want to Quit? Y/N")
  550. SWITCH(TOLOWER(NTOC(Selection)))
  551.    CASEOF "y" : QUIT
  552.    CASEOF "n" : CANCEL(On!) RETURN
  553.    DEFAULT    : GO(Cancel)
  554. ENDSWITCH
  555. CHAIN
  556.  
  557. Show Me An Example...
  558. ─────────────────────────────────────────────────────────────────
  559. CHAIN executes the specified macro when the current macro ends. 
  560. Unlike other commands, the CHAIN command does not take effect
  561. when it is encountered.  Regardless of where the CHAIN command is
  562. placed in the macro, it does not execute the chained macro until
  563. the current macro has finished.  
  564.  
  565. If a macro contains more than one CHAIN command, only the macro
  566. specified in the last encountered CHAIN command is executed.  A
  567. QUIT command at the end of the active macro overrides any pending
  568. CHAIN command and will not allow execution of the chained macro.
  569.  
  570. CHAIN looks for the specified macro first in the current
  571. directory, then in the macros directories, and finally in the
  572. shared WP directory.
  573.  
  574. Syntax:        CHAIN("Filename")
  575.  
  576. Parameters:    Filename
  577.                A character expression specifying the macro to
  578.                chain.
  579.  
  580. See Also:      NEST
  581.                              ────  ──── For Example...
  582.  
  583. This macro displays a dialog box on the screen.  Pending the
  584. user's response, the macro chains the correct macro.
  585.  
  586. DISPLAY(Off!)
  587. DLGCREATE(x;"TITLE";DLGNoCancel!;;;30;14)
  588.    DLGCONTROL(CtrlRadioButton!;a;"Letter";StyInitial!;4;4;10;2)
  589.    DLGCONTROL(CtrlRadioButton!;b;"Itinerary";;4;6;10;2)
  590.    DLGCONTROL(CtrlRadioButton!;c;"Memo";;4;8;10;2)
  591.    DLGCONTROL(CtrlRadioButton!;d;"Fax";;4;10;10;2)
  592. DLGEND
  593. SWITCH (1)
  594.    CASEOF a : CHAIN("letter")
  595.    CASEOF b : CHAIN("Itin")
  596.    CASEOF c : CHAIN("memo")
  597.    CASEOF d : CHAIN("fax")
  598. ENDSWITCH
  599. CHAR
  600.  
  601. Show Me An Example...
  602. ─────────────────────────────────────────────────────────────────
  603. The CHAR, or character, command prompts the user for a keystroke. 
  604. The numeric equivalent (ascii value) of the keystroke is then
  605. assigned to the variable specified in the CHAR command.  As the
  606. name indicates, only one character is accepted and assigned to
  607. the variable.  If the user enters more than one character or
  608. presses more than one keystroke, only the first is accepted.  If
  609. more than one keystroke needs to be assigned to a variable, use
  610. GETSTRING, GETNUMBER, OR GETUNITS.  
  611.  
  612. Generally, the keystroke is given in response to a question posed
  613. in the optional prompt parameter of this command.  The variable
  614. containing the numeric equivalent of the keystroke can be
  615. evaluated later in the macro using commands such as IF or SWITCH. 
  616. The numeric equivalent of the keystroke can also be converted
  617. back to the original keystroke using NTOC.  For a list of
  618. keystrokes and their numeric equivalents, see Appendix A in the
  619. Appendices section.
  620.  
  621. Syntax:        CHAR(Variable;"Prompt")
  622.  
  623. Parameters:    Variable
  624.                Specifies the variable to which the numeric
  625.                equivalent of the keystroke will be assigned.  Any
  626.                variable is valid for this parameter.
  627.  
  628.                Prompt (optional)
  629.                A character expression that will display as a
  630.                prompt on the status line.
  631.  
  632. See Also:      SWITCH
  633.                GETNUMBER
  634.                GETSTRING
  635.                IF
  636.                NTOC
  637.                              ────  ──── For Example...
  638.  
  639. This macro creates a secondary merge file through a series of
  640. prompts.
  641.  
  642. ASSIGN(More;"Y")
  643. WHILE(TOUPPER(More)="Y")
  644.    FOREACH(field;{"First Name";"Last 
  645.       Name";"Company";"Address";"City";"State";"Zip"})
  646.       GETSTRING(info;"Enter the "+field;"Field "+field;)
  647.       TYPE(info)
  648.       EndField
  649.       info:=""
  650.    ENDFOR
  651.    MergeCode(EndRecord!)
  652.    CHAR(More;"Enter another record? Y/N")
  653.    ASSIGN(More;NTOC(More))
  654. ENDWHILE
  655. CONTINUE
  656.  
  657. Show Me An Example...
  658. ─────────────────────────────────────────────────────────────────
  659. CONTINUE is used in a SWITCH statement to instruct a macro, after
  660. executing one CASEOF, to continue to the next CASEOF and execute
  661. it without evaluating its expression.  This command is optional
  662. and is not required as part of a SWITCH statement.
  663.  
  664. Syntax:        CONTINUE
  665.  
  666. Parameters:    None
  667.  
  668. See Also:      SWITCH
  669.                CASEOF
  670.                ENDSWITCH
  671.                              ────  ──── For Example...
  672.  
  673. This macro either types a name, an address, or the entire name
  674. and address.
  675.  
  676. DLGCREATE(x;"TITLE";DLGNoCancel!;;;30;14)
  677.    DLGCONTROL(CtrlRadioButton!;a;"Name";StyInitial!;4;4;10;2)
  678.    DLGCONTROL(CtrlRadioButton!;b;"Full Address";;4;6;10;2)
  679.    DLGCONTROL(CtrlRadioButton!;c;"Address only";;4;8;10;2)
  680. DLGEND
  681. SWITCH (1)
  682.   CASEOF a : Type("John Doe")
  683.   CASEOF b : Type("John Doe") Hrt
  684.          CONTINUE
  685.   CASEOF c : Type("123 Anywhere")
  686. ENDSWITCH
  687. CTON
  688.  
  689. Show Me An Example...
  690. ─────────────────────────────────────────────────────────────────
  691. CTON (character to number) converts a character or keystroke to
  692. its numeric equivalent.  For a list of numeric equivalents, see
  693. Appendix A in the Appendices section.  
  694.  
  695. Syntax:        CTON("Character")
  696.  
  697.  
  698. Parameters:    Character
  699.                Any ASCII character or a variable containing an
  700.                ASCII character.
  701.  
  702. See Also:      NTOC
  703.                              ────  ──── For Example...
  704.  
  705. This macro prompts for a character and returns its ascii
  706. equivalent.
  707.  
  708. GetString(x;"Enter a character:")
  709. ascii:=CTON(x)
  710. Prompt("The ASCII equivalent of "+x+" is "+ascii+".")
  711. Pause
  712. DEFAULT
  713.  
  714. Show Me An Example...
  715. ─────────────────────────────────────────────────────────────────
  716. DEFAULT is used with the SWITCH command to specify a series of
  717. commands to execute if all CASEOF expressions are false.  This
  718. command is an optional part of a SWITCH statement, but is useful
  719. for providing a default action if all other cases are false.
  720.  
  721. Syntax:        DEFAULT:
  722.  
  723. Parameters:    There are no parameters, but DEFAULT is always
  724.                followed by macro commands to execute.
  725.  
  726. See Also:      SWITCH
  727.                CASEOF
  728.                CONTINUE
  729.                ENDSWITCH
  730.                              ────  ──── For Example...
  731.  
  732. This macro constantly prompts for a name until Cancel is pressed.
  733.  
  734. ONCANCEL CALL(Cancel)
  735. LABEL(Top)
  736. Name:=""
  737. GETSTRING(Name;"Type in a name, (Cancel or Enter) to
  738. quit";"Name")
  739. IF(Name="")
  740.    ASSERT(CancelCondition!)
  741. ENDIF
  742. TYPE(Name)
  743. HRt
  744. GO(Top)
  745.  
  746. LABEL(Cancel)
  747. CANCEL(Off!)
  748. CHAR(Selection;"Do you really want to Quit? Y/N")
  749. SWITCH(TOLOWER(NTOC(Selection)))
  750.    CASEOF "y" : QUIT
  751.    CASEOF "n" : CANCEL(On!) RETURN
  752.    DEFAULT    : GO(Cancel)
  753. ENDSWITCH
  754. DEFAULTUNITS
  755.  
  756. Show Me An Example...
  757. ─────────────────────────────────────────────────────────────────
  758. DEFAULTUNITS sets the default unit of measurement for any
  759. measurement expression that does not contain a unit of measure
  760. character (", i, u, p).
  761.  
  762. Syntax:        DEFAULTUNITS(Measurement)
  763.  
  764. Parameters:    Measurement
  765.                Specifies the default unit of measurement for
  766.                measurement expressions.  Select an enumerated
  767.                type or its numeric equivalent.
  768.  
  769.                Enumerated     Numeric     Description
  770.                Type           Equivalent
  771.                ═════════════════════════════════════════════════
  772.                Inches!        0           Inches as default (")
  773.                InchesI!       1           Inches as default (i)
  774.                Centimeters!      2           Centimeters as
  775.                                              default
  776.                Millimeters!      3           Millimeters as
  777.                                              default
  778.                Points!        4           Points as default
  779.                WP1200ths!     5           1200ths of an inch as
  780.                                           default
  781.                WP42Units!     6           WP42 units as default
  782.                ═════════════════════════════════════════════════
  783.  
  784.                              ────  ──── For Example...
  785.  
  786. This macro advances four centimeters from the top of the page
  787. regardless of the current unit of measure.
  788.  
  789. DISPLAY(Off!)
  790. DefaultUnits(Centimeters!)
  791. Advance(AdvanceFromTop!;4)
  792. DISCARD
  793.  
  794. Show Me An Example...
  795. ─────────────────────────────────────────────────────────────────
  796. DISCARD removes variable definitions from the current macro as
  797. well as variables set with PERSIST or PERSISTALL.  Variables
  798. might reside in one of three variable tables: Local, Global, and
  799. Persistent.  Variables are discarded in that order.  For example,
  800. to discard local, global, and persistent variables all named
  801. ABBEY, you would need to DISCARD(ABBEY) three times to remove
  802. ABBEY from all tables.  This command does not specify the table
  803. from which the variable should be discarded; the command must
  804. simply be repeated enough times to clear the desired tables. 
  805. This could be done easily in a WHILE loop, for example:
  806.  
  807. WHILE(EXISTS(Abbey))
  808. DISCARD(Abbey)
  809. ENDWHILE
  810.  
  811. Syntax:        DISCARD(Var1;Var2;...VarN)
  812.  
  813. Parameters:    Variable
  814.                Any variable is valid for this parameter.
  815.  
  816. See Also:      ASSIGN
  817.                GLOBAL
  818.                LOCAL
  819.                PERSIST
  820.                PERSISTALL
  821.                              ────  ──── For Example...
  822.  
  823. This macro executes a function from within a TYPE command.
  824.  
  825. Prmt:="Would you like to continue?"
  826. Type ("You pressed "+YesNo(prmt))
  827.  
  828. //More code for the macro
  829. Quit
  830.  
  831.  
  832. FUNCTION YesNo (message)
  833.    LOCAL(ans)
  834.    IF (EXISTS(ans))
  835.       DISCARD(ans)
  836.    ENDIF
  837.    LABEL(Begin)
  838.    CHAR(ans;message+"  Y/N")
  839.    SWITCH(TOLOWER(NTOC(ans)))
  840.       CASEOF "y" : ans:="Y"
  841.       CASEOF "n" : ans:="N"
  842.       DEFAULT : GO(Begin)
  843.    ENDSWITCH
  844.    RETURN(ans)
  845. ENDFUNC
  846. DISPLAY
  847.  
  848. Show Me An Example...
  849. ─────────────────────────────────────────────────────────────────
  850. DISPLAY determines whether to display macro execution. 
  851. DISPLAY(Off!) is inserted at the beginning of recorded macros and
  852. will remain in effect until replaced with DISPLAY (On!) or
  853. deleted from the macro.
  854.  
  855. Syntax:        DISPLAY(State)
  856.  
  857. Parameters:    State
  858.                Specifies whether macro display is on.  Select an
  859.                enumerated type or its numeric equivalent.
  860.  
  861.                Enumerated     Numeric        Description
  862.                Type           Equivalent
  863.                ═════════════════════════════════════════════════
  864.                Off!           0              Display off
  865.                On!            1              Display on
  866.                ═════════════════════════════════════════════════
  867.  
  868.                              ────  ──── For Example...
  869.  
  870. This macro beeps if the current document is blank and displays a
  871. message.
  872.  
  873. DISPLAY(Off!)
  874. IF(?DocBlank)
  875.    BEEP
  876.    DISPLAY(On!)
  877.    PROMPT("The document is blank.  Press Tab to continue")
  878.    PAUSEKEY(TabKey)
  879.    DISPLAY(Off!)
  880.    QUIT
  881. ENDIF
  882. DIV
  883.  
  884. Show Me An Example...
  885. ─────────────────────────────────────────────────────────────────
  886. DIV is an operator that performs a division and returns the
  887. integer portion of the quotient.  For example, if the quotient is
  888. 2.5, DIV returns 2.  DIV must be used in an expression that can
  889. be evaluated by commands such as IF and ASSIGN.  DIV is preceded
  890. and followed by expressions to divide, for example, 10 DIV 2.
  891.  
  892. Parameters:    None
  893.  
  894. See Also:      AND
  895.                ASSIGN
  896.                IF
  897.                NOT
  898.                OR
  899.                REPEAT
  900.                WHILE
  901.                XOR
  902.                              ────  ──── For Example...
  903.  
  904. This macro averages a series of numbers and returns the quotient
  905. value of the average.
  906.  
  907. ASSIGN(Last;0)
  908. GETNUMBER(HowMany;"How many numbers do you have to average")
  909. ASSIGN(Y;0)
  910.  
  911. FORNEXT(Count;1;HowMany)
  912.    GETNUMBER(INDIRECT("Number"+Count);"Enter in a number  ")
  913.    ASSIGN(last;last+Indirect("Number"+Count))
  914. ENDFOR
  915.  
  916. Type("The quotient of the average of ")
  917.  
  918. FORNEXT(X;1;HowMany)
  919.    TYPE(Indirect("Number"+x)+"+")
  920. ENDFOR
  921.  
  922. DeleteCharPrevious
  923.  
  924. Type(" is "+last DIV howmany)
  925. DLGCONTROL
  926.  
  927. Show Me An Example...
  928. ─────────────────────────────────────────────────────────────────
  929. DLGCONTROL add controls such as check boxes, push buttons and
  930. radio buttons to a dialog box.  This command customizes the
  931. appearance and use of a dialog box and must be used between
  932. DLGCREATE and DLGEND commands.
  933.  
  934. Syntax:        DLGCONTROL(Type;Variable;"Title";Style;Horizontal
  935.                Position;Vertical Position;Wide;High)
  936.  
  937. Parameters:    Type
  938.                Specifies the control type to add to the dialog
  939.                box.  Select an enumerated type or its numeric
  940.                equivalent.
  941.  
  942.                Enumerated           Numeric     Description
  943.                Type                 Equivalent
  944.                ═════════════════════════════════════════════════
  945.                CtrlLabel!           0           Not numbered and
  946.                                                 cannot be
  947.                                                 selected.  Useful
  948.                                                 for adding
  949.                                                 descriptive text
  950.                                                 to a dialog. 
  951.                                                 Does not require
  952.                                                 the Variable
  953.                                                 parameter.
  954.                CtrlOption!          1           A numbered menu
  955.                                                 item that can be
  956.                                                 selected.  Forces
  957.                                                 an exit from a
  958.                                                 dialog box when
  959.                                                 selected.  Does
  960.                                                 not require the
  961.                                                 Variable
  962.                                                 parameter.
  963.                CtrlPushbutton!      2              A push button
  964.                                                    that forces an
  965.                                                    exit when
  966.                                                    selected. 
  967.                                                    Does not
  968.                                                    require the
  969.                                                    Variable
  970.                                                    parameter.
  971.                CtrlCheckbox!        3              A numbered
  972.                                                    check box that
  973.                                                    can be
  974.                                                    selected.  If
  975.                                                    the variable
  976.                                                    parameter is
  977.                                                    0, the check
  978.                                                    box will not
  979.                                                    be checked. 
  980.                                                    When the
  981.                                                    dialog is
  982.                                                    dismissed, the
  983.                                                    variable will
  984.                                                    return the
  985.                                                    state of the
  986.                                                    control
  987.                                                    (0=Checkbox
  988.                                                    not marked,
  989.                                                    1=Checkbox
  990.                                                    marked).
  991.                CtrlRadiobutton!     4              A numbered
  992.                                                    radio button. 
  993.                                                    If the
  994.                                                    variable
  995.                                                    parameter is
  996.                                                    0, the radio
  997.                                                    button will
  998.                                                    not be
  999.                                                    selected. 
  1000.                                                    When the
  1001.                                                    dialog is
  1002.                                                    dismissed, the
  1003.                                                    variable will
  1004.                                                    return the
  1005.                                                    state of the
  1006.                                                    control
  1007.                                                    (0=Radio
  1008.                                                    button not
  1009.                                                    selected,
  1010.                                                    1=Radio button
  1011.                                                    selected). To
  1012.                                                    be in the same
  1013.                                                    group, radio
  1014.                                                    button
  1015.                                                    controls must
  1016.                                                    be
  1017.                                                    consecutive. 
  1018.                                                    Radio buttons
  1019.                                                    are mutually
  1020.                                                    exclusive.
  1021.                CtrlNumber!          5           A numbered entry
  1022.                                                 field that
  1023.                                                 accepts only
  1024.                                                 positive numbers. 
  1025.                                                 The variable sets
  1026.                                                 the initial value
  1027.                                                 and when the
  1028.                                                 dialog is
  1029.                                                 dismissed,
  1030.                                                 returns the value
  1031.                                                 of the control.
  1032.                CtrlMeasure!         6              An entry field
  1033.                                                    that accepts
  1034.                                                    only
  1035.                                                    measurements. 
  1036.                                                    The
  1037.                                                    measurement is
  1038.                                                    displayed in
  1039.                                                    the current
  1040.                                                    unit of
  1041.                                                    measurement. 
  1042.                                                    The variable
  1043.                                                    sets the
  1044.                                                    initial value
  1045.                                                    and when the
  1046.                                                    dialog is
  1047.                                                    dismissed,
  1048.                                                    returns the
  1049.                                                    value of the
  1050.                                                    control.
  1051.                CtrlText!            7              An entry field
  1052.                                                    that accepts a
  1053.                                                    single line of
  1054.                                                    text.  The
  1055.                                                    line length
  1056.                                                    allowed is
  1057.                                                    determined by
  1058.                                                    the width
  1059.                                                    parameter.
  1060.                CtrlFilename!        8              An entry field
  1061.                                                    that accepts
  1062.                                                    only ASCII
  1063.                                                    characters and
  1064.                                                    no spaces. 
  1065.                                                    The variable
  1066.                                                    set the
  1067.                                                    initial value
  1068.                                                    and when the
  1069.                                                    dialog is
  1070.                                                    dismissed,
  1071.                                                    returns  the
  1072.                                                    value of the
  1073.                                                    control.
  1074.                CtrlList!            9              A list box. 
  1075.                                                    The variable
  1076.                                                    must be the
  1077.                                                    name of an
  1078.                                                    array that
  1079.                                                    defines each
  1080.                                                    item in the
  1081.                                                    list. The
  1082.                                                    array
  1083.                                                    requirements
  1084.                                                    are:
  1085.                                                    Var[0]=number
  1086.                                                    of items in
  1087.                                                    list box. 
  1088.                                                    Var[1] -
  1089.                                                    Var[x]=each
  1090.                                                    list box item.
  1091.                CtrlDropList!        10             A drop list. 
  1092.                                                    Same
  1093.                                                    requirements
  1094.                                                    for CtrlList!
  1095.                                                    above.
  1096.                ═════════════════════════════════════════════════
  1097.  
  1098.                Variable (optional)
  1099.                Sets values to and returns values from the
  1100.                controls.  See control type descriptions for
  1101.                information on how the variable works with
  1102.                specific controls.
  1103.  
  1104.                Title (optional)
  1105.                A character expression specifying the control
  1106.                title.  To create a mnemonic letter in the title,
  1107.                precede the letter with a tilde (~).
  1108.  
  1109.                Style (optional)
  1110.                Specifies a control style.  The styles can be
  1111.                concatenated with a plus sign (+), for example,
  1112.                (StyNoSpaces!+StyNoNumber!).  Select an enumerated
  1113.                type or its numeric equivalent.
  1114.  
  1115.                   Enumerated        Numeric     Description
  1116.                Type              Equivalent
  1117.                ═════════════════════════════════════════════════
  1118.                StyOK!               1           Makes a
  1119.                                                 CtrlPushButton!
  1120.                                                 function as the
  1121.                                                 OK button.  The
  1122.                                                 variable will be
  1123.                                                 0 if the
  1124.                                                 pushbutton
  1125.                                                 dismissed the
  1126.                                                 dialog.
  1127.                StyCancel!        2           Makes a
  1128.                                              CtrlPushButton!
  1129.                                              function as the
  1130.                                              Cancel button.  The
  1131.                                              variable will be -1
  1132.                                              if the pushbutton
  1133.                                              dismissed the
  1134.                                              dialog.
  1135.                StySigned!        4           Allows CtrlNumber!
  1136.                                              control to accept
  1137.                                              negative numbers.
  1138.                StyCounter!       8           Adds counter
  1139.                                              controls (up/down
  1140.                                              arrows) to the
  1141.                                              CtrlNumber! control.
  1142.                StyNoSpaces!         16          Prohibits spaces
  1143.                                                 from being
  1144.                                                 entered in the
  1145.                                                 CtrlText!
  1146.                                                 control.  With
  1147.                                                 this style, the
  1148.                                                 space bar will
  1149.                                                 terminate input.
  1150.                StyNoBox!            32          Removes the box
  1151.                                                 surrounding list
  1152.                                                 or entry controls
  1153.                                                 in Text Mode.
  1154.                StyNoSort!        64          Prevents items in a
  1155.                                              list control from
  1156.                                              being sorted.
  1157.                StyChild!            128         Makes the control
  1158.                                                 a child or sub-
  1159.                                                 control of the
  1160.                                                 previous non-
  1161.                                                 child control.
  1162.                StyNoScroll!         256         Turns off the
  1163.                                                 scroll bar on a
  1164.                                                 CtrlList!
  1165.                                                 control.
  1166.                StyNoNumber!         512         Removes the
  1167.                                                 number on a
  1168.                                                 numbered control. 
  1169.                                                 A control with
  1170.                                                 this style cannot
  1171.                                                 be selected with
  1172.                                                 a number, however
  1173.                                                 mnemonics can
  1174.                                                 still be used.
  1175.                StyDancing!       1024        Allows a control to
  1176.                                              display only when it
  1177.                                              can be selected.
  1178.                StyNoPeriod!         2048        Removes the
  1179.                                                 period after a
  1180.                                                 control number.
  1181.                StyGray!          4096        Prevents a control
  1182.                                              from being selected.
  1183.                StyMnemonic!         8192        Replaces the
  1184.                                                 control number
  1185.                                                 with the mnemonic
  1186.                                                 character
  1187.                                                 specified in the
  1188.                                                 title parameter. 
  1189.                                                 
  1190.                StyInitial!       16384       Specifies the
  1191.                                              control as the
  1192.                                              active control when
  1193.                                              a dialog is
  1194.                                              initially displayed.
  1195.                StyDefault!       32768       Specifies the
  1196.                                              control as the
  1197.                                              default control. 
  1198.                                              Any time the cursor
  1199.                                              would normally
  1200.                                              return to the OK
  1201.                                              button, it will move
  1202.                                              to this control
  1203.                                              instead.
  1204.                ═════════════════════════════════════════════════
  1205.  
  1206.                Horizontal Position (optional)
  1207.                A numeric expression specifying the horizontal
  1208.                position of the control within the dialog.  The
  1209.                position is determined in character spaces by rows
  1210.                and columns with 0 being the first column, first
  1211.                row (upper left position).
  1212.  
  1213.                Vertical Position (optional)
  1214.                See Horizontal Position parameter above.
  1215.  
  1216.                Width (optional)
  1217.                A numeric expression specifying the width of the
  1218.                control in character spaces.  If this parameter is
  1219.                not specified, the control conforms to the size of
  1220.                the control title.
  1221.  
  1222.                Height (optional)
  1223.                See Width parameter description above.  If this
  1224.                parameter is not specified, the height is set to
  1225.                2.
  1226.  
  1227. See Also:      DLGCREATE
  1228.                DLGEND
  1229.                              ────  ──── For Example...
  1230.  
  1231. This macro displays a dialog box with all the control options.
  1232.  
  1233. chkbox:=1
  1234. num:=31
  1235. LstAry:={"One";"Uno";"Ein"}
  1236. DLGCREATE(x;"TITLE";DLGNoCancel!;;;50;20)
  1237.    DLGCONTROL(CtrlLabel!;;"Descriptive Label";StyGray!;1;1;5;1)
  1238.    DLGCONTROL(CtrlOption!;;"Option";StyNoNumber!;30;3;10;2)
  1239.    DLGCONTROL(CtrlPushButton!;;"Push
  1240.       Button";StyNoNumber!;4;5;11;2)
  1241.    DLGCONTROL(CtrlCheckBox!;chkbox;"Check
  1242.       Box";StyNoNumber!;30;5;9;2)
  1243.    DLGCONTROL(CtrlRadioButton!;VarRB;"Radio
  1244.       Button";StyInitial!;4;3;10;2)
  1245.    DLGCONTROL(CtrlNumber!;num;"Number";StySigned!+StyCounter!;
  1246.       4;7;3;2)
  1247.    DLGCONTROL(CtrlMeasure!;meas;"Measurement";StyNoNumber!+
  1248.       StyNoBox!;30;7;3;2)
  1249.    DLGCONTROL(CtrlText!;txt;"Text";StyNoNumber!;4;9;35;2)
  1250.    DLGCONTROL(CtrlFilename!;flname;"~Filename";StyMnemonic!;
  1251.       4;11;12;2)
  1252.    DLGCONTROL(CtrlList!;LstAry;"List";StyNoSort!;4;13;12;3)
  1253.    DLGCONTROL(CtrlDropList!;LstAry;"Drop List";StyNoSort!+
  1254.       StyNoNumber!;25;13;12;3)
  1255. DLGEND
  1256. DLGCREATE
  1257.  
  1258. Show Me An Example...
  1259. ─────────────────────────────────────────────────────────────────
  1260. DLGCREATE is the opening command for creating and displaying a
  1261. dialog box.  The dialog box is displayed when this command is
  1262. encountered.  This command must be followed by at least one
  1263. control defined by DLGCONTROL.
  1264.  
  1265. Syntax:        DLGCREATE(Variable;"Title";Style;Horizontal
  1266.                Position;Vertical Position;Width;Height)
  1267.  
  1268. Parameters:    Variable
  1269.                Specifies the variable containing the number of
  1270.                the Control used to dismiss the dialog.
  1271.  
  1272.                Control                 Numeric     Description
  1273.                                        Equivalent
  1274.                ═════════════════════════════════════════════════
  1275.                OK                      0           Dialog
  1276.                                                    dismissed with
  1277.                                                    OK
  1278.                Cancel                     -1          Dialog
  1279.                                                       dismissed
  1280.                                                       with Cancel
  1281.                User-defined control       X           Where "X"
  1282.                                                       is the
  1283.                                                       number of
  1284.                                                       the
  1285.                                                       control. 
  1286.                                                       Control
  1287.                                                       numbers are
  1288.                                                       determined
  1289.                                                       by the
  1290.                                                       order in
  1291.                                                       which they
  1292.                                                       are created
  1293.                                                       by a
  1294.                                                       DLGCONTROL
  1295.                                                       command. 
  1296.                                                       For
  1297.                                                       example,
  1298.                                                       the first
  1299.                                                       control
  1300.                                                       defined is
  1301.                                                       1, the
  1302.                                                       second
  1303.                                                       defined is
  1304.                                                       2, and so
  1305.                                                       forth.
  1306.                ═════════════════════════════════════════════════
  1307.  
  1308.                Title
  1309.                A character expression specifying the dialog
  1310.                title.
  1311.  
  1312.                Style
  1313.                Specifies the dialog style.  Select an enumerated
  1314.                type or its numeric equivalent.
  1315.  
  1316.                Enumerated     Numeric     Description
  1317.                Type           Equivalent
  1318.                ═════════════════════════════════════════════════
  1319.                DlgNoOK!       1           Removes OK button
  1320.                DlgNoCancel!      2           Removes Cancel
  1321.                                              button
  1322.                DlgNoBorder!      4           Removes border
  1323.                DlgNoShadow!      8           Removes shadow
  1324.                DlgExit!       16          Dismisses the dialog
  1325.                                           immediately after the
  1326.                                           first key or control is
  1327.                                           pressed
  1328.                DlgNoClear!    32          Does not save or
  1329.                                           restore the screen
  1330.                DlgInactive!      64          Dialog displays
  1331.                                              while macro
  1332.                                              execution continues.
  1333.                ═════════════════════════════════════════════════
  1334.  
  1335.                Horizontal Position (optional)
  1336.                A numeric expression specifying the horizontal
  1337.                position of the dialog.  The position is
  1338.                determined in character spaces by rows and columns
  1339.                with 0 being the first column, first row (upper
  1340.                left position).  If no position is specified, the
  1341.                dialog is centered.
  1342.  
  1343.                Vertical Position (optional)
  1344.                See Horizontal Position parameter above.
  1345.  
  1346.                Width (optional)
  1347.                A numeric expression specifying the width of the
  1348.                dialog in character spaces.  If this parameter is
  1349.                not specified, the control is sized to accommodate
  1350.                the number of controls.
  1351.  
  1352.                Height (optional)
  1353.                See Width parameter above.             
  1354.  
  1355. See Also:      DLGCONTROL
  1356.                DLGEND
  1357.                              ────  ──── For Example...
  1358.  
  1359. This macro displays a dialog box on the screen.  Pending the
  1360. user's response, the macro chains the correct macro.
  1361.  
  1362. DISPLAY(Off!)
  1363. DLGCREATE(x;"TITLE";DLGNoCancel!;;;30;14)
  1364.    DLGCONTROL(CtrlRadioButton!;a;"Letter";StyInitial!;4;4;10;2)
  1365.    DLGCONTROL(CtrlRadioButton!;b;"Itinerary";;4;6;10;2)
  1366.    DLGCONTROL(CtrlRadioButton!;c;"Memo";;4;8;10;2)
  1367.    DLGCONTROL(CtrlRadioButton!;d;"Fax";;4;10;10;2)
  1368. DLGEND
  1369. SWITCH (1)
  1370.    CASEOF a : CHAIN("letter")
  1371.    CASEOF b : CHAIN("Itin")
  1372.    CASEOF c : CHAIN("memo")
  1373.    CASEOF d : CHAIN("fax")
  1374. ENDSWITCH
  1375. DLGEND
  1376.  
  1377. Show Me An Example...
  1378. ─────────────────────────────────────────────────────────────────
  1379. DLGEND is the closing command for creating and displaying dialog
  1380. boxes.
  1381.  
  1382. Syntax:        DLGEND
  1383.  
  1384. Parameters:    None
  1385.  
  1386. See Also:      DLGCONTROL
  1387.                DLGCREATE
  1388.                              ────  ──── For Example...
  1389.  
  1390. This macro displays a dialog box on the screen.  Pending the
  1391. user's response, the macro chains the correct macro.
  1392.  
  1393. DISPLAY(Off!)
  1394. DLGCREATE(x;"TITLE";DLGNoCancel!;;;30;14)
  1395.    DLGCONTROL(CtrlRadioButton!;a;"Letter";StyInitial!;4;4;10;2)
  1396.    DLGCONTROL(CtrlRadioButton!;b;"Itinerary";;4;6;10;2)
  1397.    DLGCONTROL(CtrlRadioButton!;c;"Memo";;4;8;10;2)
  1398.    DLGCONTROL(CtrlRadioButton!;d;"Fax";;4;10;10;2)
  1399. DLGEND
  1400. SWITCH (1)
  1401.    CASEOF a : CHAIN("letter")
  1402.    CASEOF b : CHAIN("Itin")
  1403.    CASEOF c : CHAIN("memo")
  1404.    CASEOF d : CHAIN("fax")
  1405. ENDSWITCH
  1406. DLGINPUT
  1407.  
  1408. Show Me An Example...
  1409. ─────────────────────────────────────────────────────────────────
  1410. DLGINPUT determines whether to suspend macro execution while a
  1411. dialog box is displayed.  If execution is suspended, the user
  1412. must close the dialog box before the macro continues.  If
  1413. execution is not suspended, the macro can be programmed to make
  1414. selections in the dialog box as well as close it.  The default
  1415. macro state is DLGINPUT(Off!).
  1416.  
  1417. Syntax:        DLGINPUT(State)
  1418.  
  1419. Parameters:    State
  1420.                Specified whether macro execution is suspended. 
  1421.                Select an enumerated type or its numeric
  1422.                equivalent.
  1423.  
  1424.                Enumerated     Numeric     Description
  1425.                Type           Equivalent
  1426.                ═════════════════════════════════════════════════
  1427.                Off!           0           Suspend macro execution
  1428.                On!            1           Do not suspend Macro
  1429.                                           execution
  1430.                ═════════════════════════════════════════════════
  1431.  
  1432.                              ────  ──── For Example...
  1433.  
  1434. This macro retrieves and prints all documents in the default
  1435. directory.
  1436.  
  1437. DISPLAY(On!)
  1438. DLGInput(on!)     // allows keystrokes to be sent to a dialog box
  1439. FileManagerDlg
  1440. HardReturn
  1441. DownArrow
  1442. tot:=?List-2
  1443. Cancelkey
  1444. cnt:=1
  1445. WHILE(tot<>cnt)
  1446.   FileManagerDlg
  1447.   FileManagerDlg
  1448.   DownArrow
  1449.   type("1")       //opens the highlighted document
  1450.   PrintFullDoc
  1451.   ExitDlg
  1452.   Type("nn")      //"No" to save and "No" to exit WordPerfect
  1453.   cnt:=cnt+1
  1454. ENDWHILE
  1455. ELSE
  1456.  
  1457. Show Me An Example
  1458. ─────────────────────────────────────────────────────────────────
  1459. ELSE is used with the IF command to specify macro commands to
  1460. execute when the IF statement is false.  Commands placed between
  1461. the ELSE and the ENDIF commands are executed only if the value of
  1462. the relational expression in the IF statement is false.  If ELSE
  1463. is not used within an IF statement, and if the statement is
  1464. false, the macro moves to the command following ENDIF and resumes
  1465. execution.
  1466.  
  1467. Syntax:        ELSE
  1468.  
  1469. Parameters:    None
  1470.  
  1471. See Also:      IF
  1472.                ENDIF
  1473.                              ────  ──── For Example...
  1474.  
  1475. This macro prints the current document path and filename in a
  1476. footer.
  1477.  
  1478. IF(?Name<>"")
  1479.   FooterB(Create!)
  1480.   TYPE(?Path+?Name)
  1481.   SubstructureExit
  1482. ELSE
  1483.   PROMPT("The file hasn't been saved yet.  Please save and re-run
  1484. the macro.")
  1485.   PAUSE
  1486. ENDIF
  1487. ENDFOR
  1488.  
  1489. Show Me An Example...
  1490. ─────────────────────────────────────────────────────────────────
  1491. ENDFOR is the closing command for a FORNEXT-ENDFOR and a FOREACH-
  1492. ENDFOR loop.
  1493.  
  1494. Syntax:        ENDFOR
  1495.  
  1496. Parameters:    None
  1497.  
  1498. See Also:      FORNEXT
  1499.                FOREACH
  1500.                              ────  ──── For Example...
  1501.  
  1502. ASSIGN(More;"Y")
  1503. WHILE(TOUPPER(More)="Y")
  1504.    FOREACH(field;{"First Name";"Last 
  1505.       Name";"Company";"Address";"City";"State";"Zip"})
  1506.       GETSTRING(info;"Enter the "+field;"Field "+field;)
  1507.       TYPE(info)
  1508.       EndField
  1509.       info:=""
  1510.    ENDFOR
  1511.    MergeCode(EndRecord!)
  1512.    CHAR(More;"Enter another record? Y/N")
  1513.    ASSIGN(More;NTOC(More))
  1514. ENDWHILE
  1515. ENDFUNC
  1516.  
  1517. Show Me An Example...
  1518. ─────────────────────────────────────────────────────────────────
  1519. ENDFUNC is the closing command for a FUNCTION definition.
  1520.  
  1521. Syntax:        ENDFUNC
  1522.  
  1523. Parameters:    None
  1524.  
  1525. See Also:      FUNCTION
  1526.                              ────  ──── For Example...
  1527.  
  1528. This macro executes a function from within a TYPE command.
  1529.  
  1530. Prmt:="Would you like to continue?"
  1531. Type ("You pressed "+YesNo(prmt))
  1532.  
  1533. //More code for the macro
  1534. Quit
  1535.  
  1536.  
  1537. FUNCTION YesNo (message)
  1538.    LOCAL(ans)
  1539.    IF (EXISTS(ans))
  1540.       DISCARD(ans)
  1541.    ENDIF
  1542.    LABEL(Begin)
  1543.    CHAR(ans;message+"  Y/N")
  1544.    SWITCH(TOLOWER(NTOC(ans)))
  1545.       CASEOF "y" : ans:="Y"
  1546.       CASEOF "n" : ans:="N"
  1547.       DEFAULT : GO(Begin)
  1548.    ENDSWITCH
  1549.    RETURN(ans)
  1550. ENDFUNC
  1551. ENDIF
  1552.  
  1553. Show Me An Example...
  1554. ─────────────────────────────────────────────────────────────────
  1555. ENDIF is the closing command for an IF-ENDIF conditional
  1556. statement.
  1557.  
  1558. Syntax:        ENDIF
  1559.  
  1560. Parameters:    None
  1561.  
  1562. See Also:      ELSE
  1563.                IF
  1564.                              ────  ──── For Example...
  1565.  
  1566. This macro prints the current document path and filename in a
  1567. footer.
  1568.  
  1569. IF(?Name<>"")
  1570.   FooterB(Create!)
  1571.   TYPE(?Path+?Name)
  1572.   SubstructureExit
  1573. ELSE
  1574.   PROMPT("The file hasn't been saved yet.  Please save and re-run
  1575. the macro.")
  1576.   PAUSE
  1577. ENDIF
  1578. ENDPROC
  1579.  
  1580. Show Me An Example...
  1581. ─────────────────────────────────────────────────────────────────
  1582. ENDPROC is the closing command for a PROCEDURE definition.
  1583.  
  1584. Syntax:        ENDPROC
  1585.  
  1586. Parameters:    None
  1587.  
  1588. See Also:      PROCEDURE
  1589.                              ────  ──── For Example...
  1590.  
  1591. This macro prompts for a file to retrieve.  It then calls a
  1592. Procedure to retrieve the file.
  1593.  
  1594. GLOBAL(Path;Filename)
  1595. LABEL(Begin)
  1596. GetString(Path;"Enter the Path of the file to retrieve.")
  1597. GetString(Filename;"Enter the filename to retrieve.")
  1598. Retrieve()     //calls the procedure Retrieve
  1599. Error(Off!)
  1600. IF(?Name="")
  1601.    GO(Begin)
  1602. ENDIF
  1603.  
  1604. QUIT
  1605.  
  1606. PROCEDURE Retrieve()
  1607.    ONERROR CALL(Error)
  1608.    FileRetrieve(Path+Filename)
  1609. ENDPROC
  1610.  
  1611. LABEL(Error)
  1612. Input("The File doesn't exist.  Press Enter to continue")
  1613. RETURN
  1614. ENDSWITCH
  1615.  
  1616. Show Me An Example...
  1617. ─────────────────────────────────────────────────────────────────
  1618. ENDSWITCH is the closing command for a SWITCH-ENDSWITCH
  1619. conditional statement.
  1620.  
  1621. Syntax:        ENDSWITCH
  1622.  
  1623. Parameters:    None
  1624.  
  1625. See Also:      SWITCH
  1626.                              ────  ──── For Example...
  1627.  
  1628. This macro constantly prompts for a name until Cancel is pressed.
  1629.  
  1630. ONCANCEL CALL(Cancel)
  1631. LABEL(Top)
  1632. Name:=""
  1633. GETSTRING(Name;"Type in a name, (Cancel or Enter) to
  1634. quit";"Name")
  1635. IF(Name="")
  1636.    ASSERT(CancelCondition!)
  1637. ENDIF
  1638. TYPE(Name)
  1639. HRt
  1640. GO(Top)
  1641.  
  1642. LABEL(Cancel)
  1643. CANCEL(Off!)
  1644. CHAR(Selection;"Do you really want to Quit? Y/N")
  1645. SWITCH(TOLOWER(NTOC(Selection)))
  1646.    CASEOF "y" : QUIT
  1647.    CASEOF "n" : CANCEL(On!) RETURN
  1648.    DEFAULT    : GO(Cancel)
  1649. ENDSWITCH
  1650. ENDWHILE
  1651.  
  1652. Show Me An Example...
  1653. ─────────────────────────────────────────────────────────────────
  1654. ENDWHILE is the closing statement for a WHILE-ENDWHILE loop.
  1655.  
  1656. Syntax:        ENDWHILE
  1657.  
  1658. Parameters:    None
  1659.  
  1660. See Also:      WHILE
  1661.                              ────  ──── For Example...
  1662.  
  1663. This macro creates a secondary merge file through a series of
  1664. prompts.
  1665.  
  1666. ASSIGN(More;"Y")
  1667. WHILE(TOUPPER(More)="Y")
  1668.    FOREACH(field;{"First Name";"Last 
  1669.       Name";"Company";"Address";"City";"State";"Zip"})
  1670.       GETSTRING(info;"Enter the "+field;"Field "+field;)
  1671.       TYPE(info)
  1672.       EndField
  1673.       info:=""
  1674.    ENDFOR
  1675.    MergeCode(EndRecord!)
  1676.    CHAR(More;"Enter another record? Y/N")
  1677.    ASSIGN(More;NTOC(More))
  1678. ENDWHILE
  1679. ERROR
  1680.  
  1681. Show Me An Example...
  1682. ─────────────────────────────────────────────────────────────────
  1683. ERROR determines whether an error condition should be ignored
  1684. while a macro is running.  By default, an error is not ignored
  1685. and generally stops macro execution.  ERROR can also redirect
  1686. execution with ONERROR.  If an ONERROR command is encountered in
  1687. the macro before an Error occurs, the macro is redirected to the
  1688. LABEL specified in ONERROR.
  1689.  
  1690. Syntax:        Error(State)
  1691.  
  1692. Parameters:    State
  1693.                Specifies whether to ignore errors.  Select an
  1694.                enumerated type or its numeric equivalent.
  1695.  
  1696.                Enumerated        Numeric        Description
  1697.                Type              Equivalent
  1698.                ═════════════════════════════════════════════════
  1699.                Off!              0              Ignore errors
  1700.                On!               1              Do not ignore
  1701.                                                 errors 
  1702.                ═════════════════════════════════════════════════
  1703.  
  1704. See Also:      ASSERT
  1705.                LABEL
  1706.                ONERROR
  1707.                              ────  ──── For Example...
  1708.  
  1709. This macro prompts for a file to retrieve.  It then calls a
  1710. Procedure to retrieve the file.
  1711.  
  1712. GLOBAL(Path;Filename)
  1713. LABEL(Begin)
  1714. GetString(Path;"Enter the Path of the file to retrieve.")
  1715. GetString(Filename;"Enter the filename to retrieve.")
  1716. Retrieve()     //calls the procedure Retrieve
  1717. Error(Off!)
  1718. IF(?Name="")
  1719.    GO(Begin)
  1720. ENDIF
  1721.  
  1722. QUIT
  1723.  
  1724. PROCEDURE Retrieve()
  1725.    ONERROR CALL(Error)
  1726.    FileRetrieve(Path+Filename)
  1727. ENDPROC
  1728.  
  1729. LABEL(Error)
  1730. Input("The File doesn't exist.  Press Enter to continue")
  1731. RETURN
  1732. EXISTS
  1733.  
  1734. Show Me An Example...
  1735. ─────────────────────────────────────────────────────────────────
  1736. EXISTS is used in conjunction with other commands, such as IF, to
  1737. determine if the specified variable exists.  For a variable to
  1738. exist, it must have been assigned a value.  The value returned
  1739. represents the variable table the variable table in which the
  1740. variable exists.
  1741.  
  1742.                Value             Description
  1743.                ═════════════════════════════════════════════════
  1744.                0                 Does not exist
  1745.                1                 Exists in local table
  1746.                2                 Exists in global table
  1747.                3                 Exists in persist table
  1748.                ═════════════════════════════════════════════════
  1749.  
  1750. Syntax:        EXISTS(Variable)
  1751.  
  1752. Parameters:    Variable
  1753.                Specifies the variable to evaluate.
  1754.  
  1755. See Also:      ENDIF
  1756.                GLOBAL
  1757.                IF
  1758.                LOCAL
  1759.                PERSIST
  1760.                              ────  ──── For Example...
  1761.  
  1762. This macro executes a function from within a TYPE command.
  1763.  
  1764. Prmt:="Would you like to continue?"
  1765. Type ("You pressed "+YesNo(prmt))
  1766.  
  1767. //More code for the macro
  1768. Quit
  1769.  
  1770.  
  1771. FUNCTION YesNo (message)
  1772.    LOCAL(ans)
  1773.    IF (EXISTS(ans))
  1774.       DISCARD(ans)
  1775.    ENDIF
  1776.    LABEL(Begin)
  1777.    CHAR(ans;message+"  Y/N")
  1778.    SWITCH(TOLOWER(NTOC(ans)))
  1779.       CASEOF "y" : ans:="Y"
  1780.       CASEOF "n" : ans:="N"
  1781.       DEFAULT : GO(Begin)
  1782.    ENDSWITCH
  1783.    RETURN(ans)
  1784. ENDFUNC
  1785. FOREACH
  1786.  
  1787. Show Me An Example...
  1788. ─────────────────────────────────────────────────────────────────
  1789. FOREACH is the opening command of a FOREACH-ENDFOR conditional
  1790. loop.  A FOREACH loop executes all commands between FOREACH and
  1791. ENDFOR.  The number of times this loop executes depends on the
  1792. number of items specified between the braces ({}).  For example,
  1793. if the command contains four Item parameters, the loop runs four
  1794. times.  Each time the loop executes, the next item is assigned to
  1795. the variable specified in the Variable parameter.  When the
  1796. variable contains the value of the last item, the loop executes a
  1797. final time.  The macro then proceeds to the command immediately
  1798. following ENDFOR and resumes.
  1799.  
  1800. Syntax:        FOREACH(Variable;{Item1;Item2;...ItemN})
  1801.  
  1802. Parameters:    Variable
  1803.                Any variable is valid for this parameter.  The
  1804.                variable specified here will contain the first
  1805.                item, and is replaced by the next item with each
  1806.                repetition of the loop.
  1807.  
  1808.                Item
  1809.                A character expression, numeric expression, or
  1810.                measurement expression specifying the item to
  1811.                assign to the variable.
  1812.  
  1813. See Also:      ENDFOR
  1814.                FORNEXT
  1815.                              ────  ──── For Example...
  1816.  
  1817. This macro creates a secondary merge file through a series of
  1818. prompts.
  1819.  
  1820. ASSIGN(More;"Y")
  1821. WHILE(TOUPPER(More)="Y")
  1822.    FOREACH(field;{"First Name";"Last 
  1823.       Name";"Company";"Address";"City";"State";"Zip"})
  1824.       GETSTRING(info;"Enter the "+field;"Field "+field;)
  1825.       TYPE(info)
  1826.       EndField
  1827.       info:=""
  1828.    ENDFOR
  1829.    MergeCode(EndRecord!)
  1830.    CHAR(More;"Enter another record? Y/N")
  1831.    ASSIGN(More;NTOC(More))
  1832. ENDWHILE
  1833. FORNEXT
  1834.  
  1835. Show Me An Example...
  1836. ─────────────────────────────────────────────────────────────────
  1837. FORNEXT is the opening command of a FORNEXT-ENDFOR conditional
  1838. loop.  The FORNEXT command begins a loop which executes all
  1839. commands between the FORNEXT and its corresponding ENDFOR a
  1840. specific number of times.  The commands between FORNEXT and
  1841. ENDFOR are executed until the Variable parameter exceeds the Stop
  1842. parameter.  When the loop has executed the specified number of
  1843. times, the macro proceeds to the command immediately following
  1844. ENDFOR and resumes.
  1845.  
  1846. Syntax:        FORNEXT(Variable;Start;Stop;Step)
  1847.  
  1848. Parameters:    Variable
  1849.                Any variable is valid for this parameter.  The
  1850.                variable specified here initially contains the
  1851.                value of the Start parameter, and will be replaced
  1852.                by an incremented (or decremented) value with each
  1853.                repetition of the loop.
  1854.  
  1855.                Start
  1856.                A numeric expression or a measurement expression
  1857.                specifying the initial value of the loop.
  1858.  
  1859.                Stop
  1860.                A numeric expression or a measurement expression
  1861.                specifying the value to terminate the loop.
  1862.  
  1863.                Step (optional)
  1864.                A numeric expression or a measurement expression
  1865.                specifying the value with which to increment the
  1866.                Variable parameter.  If this parameter is not
  1867.                specified, the Variable parameter is incremented
  1868.                (or decremented) by a value of 1.
  1869.  
  1870. See Also:      ENDFOR
  1871.                FOREACH
  1872.                              ────  ──── For Example...
  1873.  
  1874. This macro creates a user specified number of return labels.
  1875.  
  1876. Display(Off!)
  1877. GetNumber(tot;"How many return address labels would you like?")
  1878. FORNEXT(cnt;1;tot;1)
  1879.   Type("Your name")
  1880.   Hrt
  1881.   Type("Your company")
  1882.   Hrt
  1883.   Type("Your address")
  1884.   Hrt
  1885.   Type("City, State  ZIP")
  1886.   Hpg
  1887. ENDFOR
  1888. FRACTION
  1889.  
  1890. Show Me An Example...
  1891. ─────────────────────────────────────────────────────────────────
  1892. FRACTION returns the fractional portion of a numeric expression. 
  1893. For example, since the quotient of 3/2 is 1.5, FRACTION(3/2)
  1894. returns the value 0.5.  This command is generally used in
  1895. conjunction with commands such as IF, ASSIGN, or Type.
  1896.  
  1897. Syntax:        FRACTION(Number)
  1898.  
  1899. Parameters:    Number
  1900.                A numeric expression specifying the number to
  1901.                evaluate.  This numeric expression often contains
  1902.                a mathematical operation such as division.
  1903.  
  1904. See Also:      ASSIGN
  1905.                IF
  1906.                INTEGER
  1907.                Type
  1908.                              ────  ──── For Example...
  1909.  
  1910. This macro prompts for a numerator followed by a denominator and
  1911. performs the division of the two numbers.  The macro returns the
  1912. integer value of the nearest whole number.
  1913.  
  1914. DISPLAY(Off!)
  1915. GETNUMBER(num1;"Enter the numerator")
  1916. GETNUMBER(num2;"Enter the denominator")
  1917. x:=FRACTION(num1/num2)
  1918. y:=INTEGER(num1/num2)
  1919. IF(x>=0.5)
  1920.   num:=y+1
  1921. ELSE
  1922.   num:=y
  1923. ENDIF
  1924. type(num)
  1925. FUNCTION
  1926.  
  1927. Show Me An Example...
  1928. ─────────────────────────────────────────────────────────────────
  1929. FUNCTION is the opening command for a FUNCTION-ENDFUNC
  1930. definition.  A FUNCTION is a subroutine to which you can pass
  1931. information and from which you can receive information.  FUNCTION
  1932. defines the function name and the parameter names as well as
  1933. includes a series of commands to be executed when the FUNCTION is
  1934. called.  A RETURN command is used in the FUNCTION to return the
  1935. result of the function operation.  If RETURN is not used, the
  1936. FUNCTION will return a value of 0.  Commands after an ENDFUNC are
  1937. ignored, so all FUNCTIONs should be placed at the end of a macro. 
  1938. Also, a FUNCTION cannot be defined within another FUNCTION
  1939. definition.
  1940.  
  1941. Creating and calling FUNCTIONs is much like creating, filling in,
  1942. and executing your own Macro Commands.  The function name is
  1943. comparable to a command name and the parameter names represent
  1944. aspects of the FUNCTION that can be manipulated.  For example,
  1945. you could create a FUNCTION that returns the average of six
  1946. numbers.  The sequence of commands would look like this:
  1947.  
  1948. FUNCTION Avg(N1;N2;N3;N4;N5;N6)
  1949.    Sum=N1+N2+N3+N4+N5+N6
  1950.    Average=Sum/6
  1951.    RETURN(Average)
  1952. ENDFUNC
  1953.  
  1954. Notice that the FUNCTION name is Avg and that the parameters do
  1955. not contain any information; they are simply "holding places" for
  1956. number one, number two, etc..  The actual numbers to fill in the
  1957. parameters will be passed when the FUNCTION is called.  The
  1958. RETURN command returns the contents of variable Average to the
  1959. location from which the FUNCTION is called.  
  1960.  
  1961. To call a FUNCTION, you simply state the function name and fill
  1962. in the parameters.  You must pass the same number of parameters
  1963. as originally defined in the FUNCTION.  Since the FUNCTION can
  1964. return information, it must be called from within a command or
  1965. statement that can evaluate its contents or perform an action
  1966. such as IF, ASSIGN, or Type.  For example, to call FUNCTION Avg
  1967. and type the average of the six numbers passed to it, the command
  1968. is:
  1969.  
  1970. Type(Avg(4;10;65;9;11;47))
  1971.  
  1972. FUNCTIONs can be in the macro from which they are called, in
  1973. another macro, or they can be combined into a macro file library.
  1974. This library is a macro that doesn't execute, but simply contains
  1975. FUNCTIONs that may be useful in many macros.  If a FUNCTION isn't
  1976. defined in the macro that calls it, the USE command must be
  1977. placed in the calling macro to identify which macro contains the
  1978. FUNCTION.  If you are storing FUNCTIONs in a macro file library,
  1979. the file must be compiled before it can be used.  To compile,
  1980. simply play the macro.
  1981.  
  1982. Syntax:        FUNCTION  Name(Parameter1;Parameter2;...ParN)
  1983.  
  1984. Parameters:    Function Name
  1985.                Specifies the FUNCTION name.  Although this
  1986.                parameter is usually text, it is not considered a
  1987.                character expression and should not be in quotes.
  1988.  
  1989.                Parameter (optional)
  1990.                Specifies the parameter names to which information
  1991.                will be passed when the FUNCTION is called.  If no
  1992.                parameters are specified, The FUNCTION can still
  1993.                be called, executed, and evaluated.
  1994.  
  1995. See Also:      ASSIGN
  1996.                ENDFUNC
  1997.                GLOBAL
  1998.                IF
  1999.                LOCAL
  2000.                PROCEDURE
  2001.                Type
  2002.                USE
  2003.                              ────  ──── For Example...
  2004.  
  2005. This macro executes a function from within a TYPE command.
  2006.  
  2007. Prmt:="Would you like to continue?"
  2008. Type ("You pressed "+YesNo(prmt))
  2009.  
  2010. //More code for the macro
  2011. Quit
  2012.  
  2013.  
  2014. FUNCTION YesNo (message)
  2015.    LOCAL(ans)
  2016.    IF (EXISTS(ans))
  2017.       DISCARD(ans)
  2018.    ENDIF
  2019.    LABEL(Begin)
  2020.    CHAR(ans;message+"  Y/N")
  2021.    SWITCH(TOLOWER(NTOC(ans)))
  2022.       CASEOF "y" : ans:="Y"
  2023.       CASEOF "n" : ans:="N"
  2024.       DEFAULT : GO(Begin)
  2025.    ENDSWITCH
  2026.    RETURN(ans)
  2027. ENDFUNC
  2028.  
  2029.  
  2030. GETNUMBER
  2031.  
  2032. Show Me An Example...
  2033. ─────────────────────────────────────────────────────────────────
  2034. GETNUMBER displays a dialog box in which the user enters a
  2035. numeric expression.  When the dialog box displays, the macro
  2036. pauses and allows the user to enter in a number.  The number is
  2037. then assigned to the variable specified in the Variable
  2038. parameter.  If the user enters a keystroke other than a number,
  2039. the value of 0 is assigned to the variable.
  2040.  
  2041. Syntax:        GETNUMBER(Variable;"Prompt";"Title")
  2042.  
  2043. Parameters:    Variable
  2044.                Any variable is valid for this parameter.  The
  2045.                variable contains the number entered by the user.
  2046.  
  2047.                Prompt (optional)
  2048.                A character expression specifying the prompt in
  2049.                the dialog box.
  2050.  
  2051.                Title (optional)
  2052.                A character expression specifying the title of the
  2053.                dialog box.
  2054.  
  2055. See Also:      GETSTRING
  2056.                GETUNITS
  2057.                              ────  ──── For Example...
  2058.  
  2059. This macro creates a user specified number of return labels.
  2060.  
  2061. DISPLAY(Off!)
  2062. GETNUMBER(tot;"How many return address labels would you like?")
  2063. FORNEXT(cnt;1;tot;1)
  2064.   Type("Your name")
  2065.   HRt
  2066.   Type("Your company")
  2067.   HRt
  2068.   Type("Your address")
  2069.   HRt
  2070.   Type("City, State  ZIP")
  2071.   HPg
  2072. ENDFOR
  2073. GETSTRING
  2074.  
  2075. Show Me An Example...
  2076. ─────────────────────────────────────────────────────────────────
  2077. GETSTRING displays a dialog box in which the user enters a
  2078. character expression.  When the dialog box displays, the macro
  2079. pauses while the user types in text.  If the optional Length
  2080. parameter is specified, the dialog box prevents the user from
  2081. entering more text than the number of characters specified.  The
  2082. text is assigned to the variable specified in the Variable
  2083. parameter.
  2084.  
  2085. Syntax:        GETSTRING(Variable;"Prompt";"Title";Length)
  2086.  
  2087. Parameters:    Variable
  2088.                Any variable is valid for this parameter.  The
  2089.                variable contains the text typed in by the user.
  2090.  
  2091.                Prompt (optional)
  2092.                A character expression specifying the prompt in
  2093.                the dialog box.
  2094.  
  2095.                Title (optional)
  2096.                A character expression specifying the title of the
  2097.                dialog box.
  2098.  
  2099.                Length (optional)
  2100.                A numeric expression specifying, in characters,
  2101.                the maximum amount of text allowed.
  2102.  
  2103. See Also:      GETNUMBER
  2104.                GETUNITS
  2105.                              ────  ──── For Example...
  2106.  
  2107. This macro prompts for a character and returns its ascii
  2108. equivalent.
  2109.  
  2110. GETSTRING(x;"Enter a character:")
  2111. ascii:=CTON(x)
  2112. PROMPT("The ASCII equivalent of "+x+" is "+ascii+".")
  2113. PAUSE
  2114. GETUNITS
  2115.  
  2116. Show Me An Example...
  2117. ─────────────────────────────────────────────────────────────────
  2118. GETUNITS displays a dialog box in which the user enters a
  2119. measurement expression and, optionally, a unit of measurement
  2120. character (",i,u,p).  When the dialog box displays, the macro
  2121. pauses while the user types in a measurement.  If no character is
  2122. specified, the macro will use the default unit of measurement.
  2123.  
  2124. Syntax:        GETUNITS(Variable;"Prompt";"Title")
  2125.  
  2126. Parameters:    Variable
  2127.                Any variable is valid for this parameter.  The
  2128.                variable contains the measurement entered by the
  2129.                user.
  2130.  
  2131.                Prompt (optional)
  2132.                A character expression specifying the prompt in
  2133.                the dialog box.
  2134.  
  2135.                Title (optional)
  2136.                A character expression specifying the title of the
  2137.                dialog box.
  2138.  
  2139. See Also:      GETNUMBER
  2140.                GETSTRING
  2141.                              ────  ──── For Example...
  2142.  
  2143. This macro prompts for and sets top and bottom margins.
  2144.  
  2145. SAVESTATE
  2146. AutoCodePlacement(On!)
  2147. SetupSave
  2148. GETUNITS(margint;"Enter top margin";"Margin")
  2149. GETUNITS(marginb;"Enter bottom margin";"Margin")
  2150. MarginTop(margint)
  2151. MarginBottom(marginb)
  2152. GLOBAL
  2153.  
  2154. Show Me An Example...
  2155. ─────────────────────────────────────────────────────────────────
  2156. GLOBAL specifies variables to be used in the current macro, in
  2157. FUNCTION's or PROCEDURE's of the current macro, or chained or
  2158. nested macros.
  2159.  
  2160. Syntax:        GLOBAL(Var1;Var2;...VarN)
  2161.  
  2162. Parameters:    Variable
  2163.                Any variable is valid for this parameter. 
  2164.  
  2165. See Also:      CHAIN
  2166.                FUNCTION
  2167.                LOCAL
  2168.                NEST
  2169.                PERSIST
  2170.                PROCEDURE
  2171.                              ────  ──── For Example...
  2172.  
  2173. This macro prompts for a file to retrieve.  It then calls a
  2174. Procedure to retrieve the file.
  2175.  
  2176. GLOBAL(Path;Filename)
  2177. LABEL(Begin)
  2178. GETSTRING(Path;"Enter the Path of the file to retrieve.")
  2179. GETSTRING(Filename;"Enter the filename to retrieve.")
  2180. Retrieve()     //calls the procedure Retrieve
  2181. ERROR(Off!)
  2182. IF(?Name="")
  2183.    GO(Begin)
  2184. ENDIF
  2185.  
  2186. QUIT
  2187.  
  2188. PROCEDURE Retrieve()
  2189.    ONERROR CALL(Error)
  2190.    FileRetrieve(Path+Filename)
  2191. ENDPROC
  2192.  
  2193. LABEL(Error)
  2194. INPUT("The File doesn't exist.  Press Enter to continue")
  2195. RETURN
  2196. GO
  2197.  
  2198. Show Me An Example...
  2199. ─────────────────────────────────────────────────────────────────
  2200. GO redirects macro execution to the label specified in the Label
  2201. parameter.
  2202.  
  2203. Syntax:        GO(Label)
  2204.  
  2205. Parameters:    Label
  2206.                Specifies the label to which the macro should be
  2207.                directed.  The specified label must match a label
  2208.                specified by a LABEL command elsewhere in the
  2209.                macro.
  2210.  
  2211. See Also:      CALL
  2212.                LABEL
  2213.                              ────  ──── For Example...
  2214.  
  2215. This macro searches for a period (.) followed by two spaces and
  2216. capitalizes the first letter of the next sentence.
  2217.  
  2218. DISPLAY(Off!)
  2219. PosDocTop
  2220. CALL(Convert)
  2221.  
  2222. ONNOTFOUND(NotFnd)
  2223. LABEL(Begin)
  2224. SearchString(".  ")
  2225. SearchNext
  2226. CALL(Convert)
  2227. GO(Begin)
  2228.  
  2229. LABEL(Convert)
  2230. BlockOn(CharMode!)
  2231. PosCharNext
  2232. ConvertCaseUppercase
  2233. BlockOff
  2234. RETURN
  2235.  
  2236. LABEL(NotFnd)
  2237. DISPLAY(On!)
  2238. PROMPT("It's finished.  Press ENTER to continue.")
  2239. PAUSE
  2240. PosDocTop
  2241. IF
  2242.  
  2243. Show Me An Example...
  2244. ─────────────────────────────────────────────────────────────────
  2245. IF is the opening command of a IF-ENDIF conditional statement. 
  2246. An IF statement permits the execution of a series of commands
  2247. only if certain conditions exist.  The IF command contains a
  2248. relational expression that can be evaluated as true or false. 
  2249. For example, NUMBER>28 is a relational expression that could be
  2250. either true or false depending on the value of variable NUMBER.
  2251.  
  2252. When an IF expression is true, the commands directly after IF are
  2253. executed.  When an expression is false, the macro proceeds
  2254. directly to the ENDIF command and resumes.  To execute certain
  2255. commands only when the IF expression is false, use ELSE.
  2256.  
  2257. Syntax:        IF(Test)
  2258.  
  2259. Parameters:    Test
  2260.                A relational expression specifying the condition
  2261.                to evaluate.
  2262.  
  2263. See Also:      AND
  2264.                ELSE
  2265.                ENDIF
  2266.                NOT
  2267.                OR
  2268.                XOR
  2269.                              ────  ──── For Example...
  2270.  
  2271. This macro prints the current document path and filename in a
  2272. footer.
  2273.  
  2274. IF(?Name<>"")
  2275.   FooterB(Create!)
  2276.   TYPE(?Path+?Name)
  2277.   SubstructureExit
  2278. ELSE
  2279.   PROMPT("The file hasn't been saved yet.  Please save and re-run
  2280. the macro.")
  2281.   PAUSE
  2282. ENDIF
  2283. INDIRECT
  2284.  
  2285. Show Me An Example...
  2286. ─────────────────────────────────────────────────────────────────
  2287. INDIRECT returns the contents of the specified variable. 
  2288. INDIRECT allows the variable name to be concatenated through any
  2289. combination of character expressions, numeric expressions, or
  2290. existing variables.  This command is used in conjunction with
  2291. other commands such as IF or Type.
  2292.  
  2293. For Example:
  2294.  
  2295. S1="New York"
  2296. S2="Georgia"
  2297. S3="Oregon"
  2298.  
  2299. FORNEXT(A;1;3;1)
  2300.    Type("The state of ")
  2301.    Type(INDIRECT("S"+A))
  2302.    Hardreturn
  2303. ENDFOR
  2304.  
  2305. In this example, INDIRECT creates the variable names S1, S2, and
  2306. S3 by concatenating the character expression "S" and the variable
  2307. A.  The variable names have been created indirectly in the
  2308. FORNEXT loop to eliminate the need to request them individually.
  2309.  
  2310.  
  2311. Syntax:        INDIRECT(Variable)
  2312.  
  2313. Parameters:    Variable
  2314.                A combination of character expressions, numeric
  2315.                expressions, or variables specifying the variable
  2316.                name.
  2317.  
  2318. See Also:      ASSIGN
  2319.                              ────  ──── For Example...
  2320.  
  2321. This macro averages a series of numbers and returns the quotient
  2322. value of the average.
  2323.  
  2324. ASSIGN(Last;0)
  2325. GETNUMBER(HowMany;"How many numbers do you have to average")
  2326. ASSIGN(Y;0)
  2327.  
  2328. FORNEXT(Count;1;HowMany)
  2329.    GETNUMBER(INDIRECT("Number"+Count);"Enter in a number  ")
  2330.    ASSIGN(last;last+Indirect("Number"+Count))
  2331. ENDFOR
  2332.  
  2333. Type("The quotient of the average of ")
  2334.  
  2335. FORNEXT(X;1;HowMany)
  2336.    TYPE(Indirect("Number"+x)+"+")
  2337. ENDFOR
  2338.  
  2339. DeleteCharPrevious
  2340.  
  2341. Type(" is "+last DIV howmany)
  2342. INPUT
  2343.  
  2344. Show Me An Example...
  2345. ─────────────────────────────────────────────────────────────────
  2346. INPUT displays a prompt, pausing the macro while the user enters
  2347. any necessary keystrokes.  The macro remains paused until the
  2348. user presses Enter or the command specified in the last PAUSESET. 
  2349. This command is similar to using PROMPT and PAUSE together. 
  2350. However, the PROMPT message is removed from the screen as soon as
  2351. any key is pressed.  INPUT is also similar to using STATUSPROMPT
  2352. and PAUSE together.  However, the STATUSPROMPT message is removed
  2353. only by a blank STATUSPROMPT or by a blank INPUT.
  2354.  
  2355. Syntax:        INPUT("Prompt")
  2356.  
  2357. Parameters:    Prompt
  2358.                A character expression specifying the prompt to
  2359.                display.
  2360.  
  2361. See Also:      INPUT
  2362.                PAUSE
  2363.                PAUSESET
  2364.                PROMPT
  2365.                STATUSPROMPT
  2366.                              ────  ──── For Example...
  2367.  
  2368. This macro prompts for a file to retrieve.  It then calls a
  2369. Procedure to retrieve the file.
  2370.  
  2371. GLOBAL(Path;Filename)
  2372. LABEL(Begin)
  2373. GETSTRING(Path;"Enter the Path of the file to retrieve.")
  2374. GETSTRING(Filename;"Enter the filename to retrieve.")
  2375. Retrieve()     //calls the procedure Retrieve
  2376. ERROR(Off!)
  2377. IF(?Name="")
  2378.    GO(Begin)
  2379. ENDIF
  2380.  
  2381. QUIT
  2382.  
  2383. PROCEDURE Retrieve()
  2384.    ONERROR CALL(Error)
  2385.    FileRetrieve(Path+Filename)
  2386. ENDPROC
  2387.  
  2388. LABEL(Error)
  2389. INPUT("The File doesn't exist.  Press Enter to continue")
  2390. RETURN
  2391. INTEGER
  2392.  
  2393. Show Me An Example...
  2394. ─────────────────────────────────────────────────────────────────
  2395. INTEGER returns the integer portion of the specified numeric
  2396. expression.  For example, INTEGER(43/2) returns the value of 21. 
  2397. The fractional portion (0.5) is ignored.  This command is
  2398. generally used in conjunction with such commands as IF, ASSIGN,
  2399. or Type.
  2400.  
  2401. Syntax:        INTEGER(Number)
  2402.  
  2403. Parameters:    Number
  2404.                A numeric expression specifying the number to
  2405.                evaluate.  This numeric expression often contains
  2406.                a mathematical operation such as division.
  2407.  
  2408. See Also:      ASSIGN
  2409.                IF
  2410.                FRACTION
  2411.                Type
  2412.  
  2413.                              ────  ──── For Example...
  2414.  
  2415. This macro prompts for a numerator followed by a denominator and
  2416. performs the division of the two numbers.  The macro returns the
  2417. integer value of the nearest whole number.
  2418.  
  2419. DISPLAY(Off!)
  2420. GETNUMBER(num1;"Enter the numerator")
  2421. GETNUMBER(num2;"Enter the denominator")
  2422. x:=FRACTION(num1/num2)
  2423. y:=INTEGER(num1/num2)
  2424. IF(x>=0.5)
  2425.   num:=y+1
  2426. ELSE
  2427.   num:=y
  2428. ENDIF
  2429. Type(num)
  2430. LABEL
  2431.  
  2432. Show Me An Example...
  2433. ─────────────────────────────────────────────────────────────────
  2434. LABEL marks a specific location, sometimes called a subroutine,
  2435. in a macro.  Execution can be directed to that location from
  2436. anywhere in the macro using commands such as CALL, GO, ONCANCEL,
  2437. ONERROR, and ONNOTFOUND.
  2438.  
  2439. A macro can contain an unlimited number of LABEL commands, but
  2440. each label must have a unique name.  Label names cannot include
  2441. spaces or be longer that thirty characters.
  2442.  
  2443. Syntax:        LABEL(Label Name)
  2444.  
  2445. Parameters:    Label Name
  2446.                Specifies the label name.  Although the name
  2447.                usually consists of text, it is not considered a
  2448.                character expression and should not be enclosed in
  2449.                quotation marks.
  2450.  
  2451. See Also:      CALL
  2452.                GO
  2453.                ONCANCEL
  2454.                ONERROR
  2455.                ONNOTFOUND
  2456.                              ────  ──── For Example...
  2457.  
  2458. This macro searches for a period (.) followed by two spaces and
  2459. capitalizes the first letter of the next sentence.
  2460.  
  2461. DISPLAY(Off!)
  2462. PosDocTop
  2463. CALL(Convert)
  2464.  
  2465. ONNOTFOUND(NotFnd)
  2466. LABEL(Begin)
  2467. SearchString(".  ")
  2468. SearchNext
  2469. CALL(Convert)
  2470. GO(Begin)
  2471.  
  2472. LABEL(Convert)
  2473. BlockOn(CharMode!)
  2474. PosCharNext
  2475. ConvertCaseUppercase
  2476. BlockOff
  2477. RETURN
  2478.  
  2479. LABEL(NotFnd)
  2480. DISPLAY(On!)
  2481. PROMPT("It's finished.  Press ENTER to continue.")
  2482. PAUSE
  2483. PosDocTop
  2484. LOCAL
  2485.  
  2486. Show Me An Example...
  2487. ─────────────────────────────────────────────────────────────────
  2488. LOCAL is used to ensure that a variable is local to a FUNCTION,
  2489. PROCEDURE, or macro.  Once the PROCEDURE or FUNCTION, or macro
  2490. has executed, the local variables are discarded from memory and
  2491. are no longer available.
  2492.  
  2493. Syntax:        LOCAL(Var1;Var2;...VarN)
  2494.  
  2495. Parameters:    Variable
  2496.                Any variable is valid for this parameter.
  2497.  
  2498. See Also:      DISCARD
  2499.                FUNCTION
  2500.                GLOBAL
  2501.                PERSIST
  2502.                PERSISTALL
  2503.                PROCEDURE
  2504.                              ────  ──── For Example...
  2505.  
  2506. This macro executes a function from within a TYPE command.
  2507.  
  2508. Prmt:="Would you like to continue?"
  2509. Type ("You pressed "+YesNo(prmt))
  2510.  
  2511. //More code for the macro
  2512. Quit
  2513.  
  2514.  
  2515. FUNCTION YesNo (message)
  2516.    LOCAL(ans)
  2517.    IF (EXISTS(ans))
  2518.       DISCARD(ans)
  2519.    ENDIF
  2520.    LABEL(Begin)
  2521.    CHAR(ans;message+"  Y/N")
  2522.    SWITCH(TOLOWER(NTOC(ans)))
  2523.       CASEOF "y" : ans:="Y"
  2524.       CASEOF "n" : ans:="N"
  2525.       DEFAULT : GO(Begin)
  2526.    ENDSWITCH
  2527.    RETURN(ans)
  2528. ENDFUNC
  2529. LOOK
  2530.  
  2531. Show Me An Example...
  2532. ─────────────────────────────────────────────────────────────────
  2533. LOOK evaluates whether a key was pressed by the user.  If a key
  2534. has been pressed, the numeric equivalent of the key is assigned
  2535. to the variable specified in the Variable parameter.  If a key
  2536. has not been pressed, the contents of the variable is assigned
  2537. the value of 0 and the macro continues.  LOOK is most useful in
  2538. macros that execute certain commands only if a specific key is
  2539. pressed.  This command is used in conjunction with commands
  2540. designed to evaluate expressions such as SWITCH, IF, or REPEAT. 
  2541. For a list of the keys and their numeric equivalents, see
  2542. Appendix A in the Appendices section.
  2543.  
  2544. Syntax:        LOOK(Variable)
  2545.  
  2546. Parameters:    Variable
  2547.                Specifies the variable to contain the numeric
  2548.                equivalent of the key.
  2549.  
  2550. See Also:      SWITCH
  2551.                IF
  2552.                NTOC
  2553.                REPEAT
  2554.                              ────  ──── For Example...
  2555.  
  2556. This macro counts keystrokes until the user presses Ctrl-Enter.
  2557.  
  2558. STATUSPROMPT("Press Ctrl+Enter to quit")
  2559. cnt:=0
  2560. REPEAT
  2561.   LOOK(info)
  2562.   IF((info<>0) AND (info<>-8097))
  2563.     cnt:=cnt+1
  2564.     Type(NTOC(info))
  2565.   ENDIF
  2566. UNTIL(info=-8097)
  2567. STATUSPROMPT("")
  2568. PAUSESET(EndFieldKey)
  2569. PROMPT("You pressed "+cnt+" keystrokes.  Press F9 to continue")
  2570. PAUSE
  2571. MENULIST
  2572.  
  2573. Show Me An Example...
  2574. ─────────────────────────────────────────────────────────────────
  2575. MENULIST displays a dialog box containing the specified menu
  2576. items.  The items displayed in the dialog box are numbered
  2577. automatically.  The number of the item selected by the user is
  2578. assigned to the variable specified in the Variable parameter. 
  2579. Once the variable has been assigned, it can be evaluated with
  2580. such commands as IF or SWITCH.
  2581.  
  2582. Syntax:        MENULIST(Variable;{"Item1";"Item2";..."ItemN"};"Ti
  2583.                tle";Horizontal Position;Vertical Position)
  2584.  
  2585. Parameters:    Variable
  2586.                Any variable is valid for this parameter.  The
  2587.                variable contains the number of the selected item.
  2588.  
  2589.                Item
  2590.                A character expression specifying the item.
  2591.  
  2592.                Title (optional)
  2593.                A character expression specifying the title of the
  2594.                dialog box.
  2595.  
  2596.                Horizontal Position (optional)
  2597.                A numeric expression specifying the horizontal
  2598.                position of the dialog box.  If this parameter is
  2599.                not specified, the dialog will be centered.
  2600.  
  2601.                Vertical Position (optional)
  2602.                A numeric expression specifying the vertical
  2603.                position of the dialog box.  If this parameter is
  2604.                not specified, the dialog will be centered.
  2605.  
  2606. See Also:      SWITCH
  2607.                IF
  2608.                              ────  ──── For Example...
  2609.  
  2610. This macro displays a menu from which the user chooses to whom
  2611. they are writing a letter.
  2612.  
  2613. TYPE("Dear ")
  2614. MENULIST(choice;{"WordPerfect Corp";"Mom and Dad";"President of
  2615. the US"})
  2616. SWITCH(choice)
  2617.    CASEOF 1 : Type("Customer Support")
  2618.    CASEOF 2 : Type("Mom and Dad")
  2619.    CASEOF 3 : Type("Mr. President")
  2620. ENDSWITCH
  2621. Type(",")
  2622. Hrt
  2623. Hrt
  2624. NEST
  2625.  
  2626. Show Me An Example...
  2627. ─────────────────────────────────────────────────────────────────
  2628. NEST temporarily transfers control from the current macro to
  2629. another macro.  The transfer occurs when this command is
  2630. encountered in the current macro.  When the nested macro is
  2631. complete, control returns to the parent macro and continues.
  2632.  
  2633. Syntax:        NEST("Macro")
  2634.  
  2635. Parameters:    Macro
  2636.                A character expression specifying the macro to
  2637.                nest.  The path and .WPM extension are optional.
  2638.  
  2639. See Also:      CHAIN
  2640.                              ────  ──── For Example...
  2641.  
  2642. This macro nests a macro RTRN_ADD.WPM which types a users return
  2643. address.  It then allows the user to fill in the inside address
  2644. and salutation.
  2645.  
  2646. NEST("rtrn_add.wpm")
  2647. Hrt
  2648. Hrt
  2649. STATUSPROMPT("Enter the inside address and press F9 to continue")
  2650. PAUSECOMMAND(EndField)
  2651. Hrt
  2652. Hrt
  2653. Type("Dear ")
  2654. STATUSPROMPT("Enter the salutation and press Enter")
  2655. PAUSE
  2656. STATUSPROMPT("")
  2657. Type(",")
  2658. Hrt
  2659. Hrt
  2660. NEXT
  2661.  
  2662. Show Me An Example...
  2663. ─────────────────────────────────────────────────────────────────
  2664. NEXT executes the next cycle or iteration of a FORNEXT, FOREACH,
  2665. WHILE or REPEAT loop.  Usually, the ENDFOR, ENDWHILE, or UNTIL
  2666. command ends the current iteration and directs execution to the
  2667. beginning of the loop to start the next iteration.  NEXT sends
  2668. execution to the next iteration from a location other than at the
  2669. end of the loop.  For example, you might use nested IF statements
  2670. as part of the loop and if a specific condition exists, NEXT
  2671. causes the remaining commands to be ignored and the loop proceeds
  2672. directly to the next iteration.
  2673.  
  2674. Syntax:        NEXT
  2675.  
  2676. Parameters:    None
  2677.  
  2678. See Also:      BREAK
  2679.                FORNEXT
  2680.                FOREACH
  2681.                REPEAT
  2682.                WHILE
  2683.                              ────  ──── For Example...
  2684.  
  2685. This macro parses an array and displays the student name and
  2686. grade.
  2687.  
  2688. student[1]:="Mark B.  PE 132  A"
  2689. student[2]:="Kerry R.  Physics 305  B"
  2690. student[3]:="Ralph D.  CS 351  A"
  2691. student[4]:="John B.  Math 402  B"
  2692.  
  2693. FORNEXT(x;1;4;1)
  2694.    len:=STRLEN(student[x])
  2695.    namepos:=STRPOS(student[x];" ")
  2696.    IF((len=0) OR (namepos=0))
  2697.       NEXT
  2698.       name:="xxx"
  2699.    ENDIF
  2700.    name:=SUBSTR(student[x];1;namepos-1)
  2701.    grade:=SUBSTR(student[x];len;1)
  2702.    Type(name)
  2703.    FORNEXT(space;1;15-namepos;1)
  2704.       Type(" ")
  2705.    ENDFOR
  2706.    Type(grade)
  2707.    HRt
  2708. ENDFOR
  2709. NOT
  2710.  
  2711. Show Me An Example...
  2712. ─────────────────────────────────────────────────────────────────
  2713. NOT is an operator that evaluates an expression in a conditional
  2714. statement and/or returns the complement of an expression.  This
  2715. command performs a logical NOT.  Use NOT when you want the
  2716. conditional statement to be evaluated as true only if the
  2717. complement of the expression is true, in other words, NOT true
  2718. means it is false.  This operator is used in conjunction with
  2719. such commands as IF, REPEAT, and WHILE.
  2720.  
  2721. Syntax:        NOT
  2722.  
  2723. Parameters:    None
  2724.  
  2725. See Also:      AND
  2726.                IF
  2727.                OR
  2728.                REPEAT
  2729.                WHILE
  2730.                XOR
  2731.                              ────  ──── For Example...
  2732.  
  2733. This macro places the path and filename of the current document
  2734. in a header.
  2735.  
  2736. Header:=1=1
  2737. ONNOTFOUND CALL(Assign)
  2738. PosDocVeryTop
  2739. SearchString("[Header A]")
  2740. SearchNext()
  2741. NOTFOUND(Off!)
  2742. IF(NOT Header)
  2743.    HeaderA(Create!)
  2744. ELSE
  2745.    HeaderA(Edit!)
  2746. ENDIF
  2747. DeleteToEndOfLine
  2748. Type(?Path+?Name)
  2749. SubstructureExit
  2750. QUIT
  2751. LABEL(ASSIGN)
  2752. Header:=1=0
  2753. RETURN
  2754. NOTFOUND
  2755.  
  2756. Show Me An Example...
  2757. ─────────────────────────────────────────────────────────────────
  2758. NOTFOUND determines whether to ignore a Not Found condition
  2759. during macro execution.  A Not Found condition most commonly
  2760. occurs when a search fails.  By default, Not Found conditions are
  2761. not ignored and will generally stop the macro.   NOTFOUND can
  2762. also be used to redirect macro execution with ONNOTFOUND.  If an
  2763. ONNOTFOUND command occurs in the macro before a Not Found
  2764. condition occurs, the macro is redirected to the label specified
  2765. by ONNOTFOUND.
  2766.  
  2767. Syntax:        NOTFOUND(State)
  2768.  
  2769. Parameters:    State
  2770.                Specifies whether to ignore a Not Found.  Select
  2771.                an enumerated type or its numeric equivalent.
  2772.  
  2773.                Enumerated        Numeric        Description
  2774.                Type              Equivalent
  2775.                ═════════════════════════════════════════════════
  2776.                Off!              0              Ignore Not Found
  2777.                On!               1              Do not ignore Not
  2778.                                                 Found
  2779.                ═════════════════════════════════════════════════
  2780.  
  2781. See Also:      ASSERT
  2782.                ?NotFound
  2783.                ONNOTFOUND
  2784.                              ────  ──── For Example...
  2785.  
  2786. This macro places the path and filename of the current document
  2787. in a header.
  2788.  
  2789. Header:=1=1
  2790. ONNOTFOUND CALL(Assign)
  2791. PosDocVeryTop
  2792. SearchString("[Header A]")
  2793. SearchNext()
  2794. NOTFOUND(Off!)
  2795. IF(NOT Header)
  2796.    HeaderA(Create!)
  2797. ELSE
  2798.    HeaderA(Edit!)
  2799. ENDIF
  2800. DeleteToEndOfLine
  2801. Type(?Path+?Name)
  2802. SubstructureExit
  2803. QUIT
  2804. LABEL(ASSIGN)
  2805. Header:=1=0
  2806. RETURN
  2807. NTOC
  2808.  
  2809. Show Me An Example...
  2810. ─────────────────────────────────────────────────────────────────
  2811. NTOC (Number To Character) converts a WordPerfect key value or
  2812. character set number to its character equivalent.  The number is
  2813. equal to the character number multiplied by 256 plus the
  2814. character number.  For example, Ç is character 38 in Character
  2815. Set 1.  Multiply 256 times 1 (256), then add 38 (294).  The NTOC
  2816. of 294 is Ç.  NTOC returns an empty string ("") if a number is
  2817. used which has no character equivalent.
  2818.  
  2819. Syntax:        NTOC(Number)
  2820.  
  2821. Parameters:    Number
  2822.                A numeric expression specifying the number to
  2823.                convert.
  2824.  
  2825. See Also:      CTON
  2826.                              ────  ──── For Example...
  2827.  
  2828. This macro creates a secondary merge file through a series of
  2829. prompts.
  2830.  
  2831. ASSIGN(More;"Y")
  2832. WHILE(TOUPPER(More)="Y")
  2833.    FOREACH(field;{"First Name";"Last 
  2834.       Name";"Company";"Address";"City";"State";"Zip"})
  2835.       GETSTRING(info;"Enter the "+field;"Field "+field;)
  2836.       TYPE(info)
  2837.       EndField
  2838.       info:=""
  2839.    ENDFOR
  2840.    MergeCode(EndRecord!)
  2841.    CHAR(More;"Enter another record? Y/N")
  2842.    ASSIGN(More;NTOC(More))
  2843. ENDWHILE
  2844. NUMSTR
  2845.  
  2846. Show Me An Example...
  2847. ─────────────────────────────────────────────────────────────────
  2848. NUMSTR converts a numeric expression or a measurement expression
  2849. to a character expression.  Numbers converted with NUMSTR are
  2850. regarded as text by the macro.  This command is used in
  2851. conjunction with commands that evaluates expressions such as
  2852. ASSIGN or Type.
  2853.  
  2854. Syntax:        NUMSTR(Number;Right Digits;Left Digits)
  2855.  
  2856. Parameters:    Number
  2857.                A numeric or measurement expression specifying the
  2858.                number to convert.
  2859.  
  2860.                Right Digits (optional)
  2861.                A numeric expression specifying the number of
  2862.                digits right of the decimal.
  2863.  
  2864.                Left Digits (optional)
  2865.                A numeric expression specifying the number of
  2866.                digits left of the decimal.
  2867.  
  2868. See Also:      STRNUM
  2869.                              ────  ──── For Example...
  2870.  
  2871. This macro defines page numbering in the form Current of Total (1
  2872. of 5).
  2873.  
  2874. DISPLAY(Off!)
  2875. PosDocBottom
  2876. TotPgNum:=?page
  2877. PosDocTop
  2878. TotPgStr:=NUMSTR(TotPgNum)
  2879. PageNumberPosition(BottomCenter!;UseDefaultValues!)
  2880. PageNumberFormat("[page #] of "+TotPgStr)
  2881. ONCANCEL
  2882.  
  2883. Show Me An Example...
  2884. ─────────────────────────────────────────────────────────────────
  2885. ONCANCEL directs macro execution to the specified LABEL command
  2886. when a Cancel occurs.  If an ONCANCEL command has not been
  2887. encountered when a Cancel occurs, the macro will stop.  If a
  2888. Cancel occurs after two or more ONCANCEL commands, the macro is
  2889. directed to the LABEL command specified in the last encountered
  2890. ONCANCEL command in the active macro.
  2891.  
  2892. ONCANCEL also includes the option of calling a LABEL if you use
  2893. ONCANCEL CALL.  This option of ONCANCEL can also call a
  2894. PROCEDURE.  If you call a LABEL, include a RETURN command at the
  2895. end of the commands to be executed by the specified LABEL.  This
  2896. returns the macro execution to the command immediately following
  2897. the command most recently executed when the Cancel occurred.  
  2898.  
  2899. Syntax:        ONCANCEL(Label)
  2900.                or
  2901.                ONCANCEL CALL (Label)
  2902.  
  2903. Parameters:    Label
  2904.                The label must correspond to a LABEL command
  2905.                within the macro.  If using ONCANCEL CALL, this
  2906.                parameter can be a PROCEDURE.
  2907.  
  2908. See Also:      ASSERT
  2909.                LABEL
  2910.                ONERROR
  2911.                ONNOTFOUND
  2912.                PROCEDURE
  2913.                RETURN
  2914.                              ────  ──── For Example...
  2915.  
  2916. This macro constantly prompts for a name until Cancel is pressed.
  2917.  
  2918. ONCANCEL CALL(Cancel)
  2919. LABEL(Top)
  2920. Name:=""
  2921. GETSTRING(Name;"Type in a name, (Cancel or Enter) to
  2922. quit";"Name")
  2923. IF(Name="")
  2924.    ASSERT(CancelCondition!)
  2925. ENDIF
  2926. TYPE(Name)
  2927. HRt
  2928. GO(Top)
  2929.  
  2930. LABEL(Cancel)
  2931. CANCEL(Off!)
  2932. CHAR(Selection;"Do you really want to Quit? Y/N")
  2933. SWITCH(TOLOWER(NTOC(Selection)))
  2934.    CASEOF "y" : QUIT
  2935.    CASEOF "n" : CANCEL(On!) RETURN
  2936.    DEFAULT    : GO(Cancel)
  2937. ENDSWITCH
  2938. ONERROR
  2939.  
  2940. Show Me An Example...
  2941. ─────────────────────────────────────────────────────────────────
  2942. ONERROR directs macro execution to the specified LABEL command
  2943. when an Error occurs.  If ONERROR has not been encountered when
  2944. an Error occurs, the macro will stop.  If an Error occurs after
  2945. two or more ONERROR commands, the macro is directed to the LABEL
  2946. command specified in the last encountered ONERROR command in the
  2947. active macro.
  2948.  
  2949. ONERROR also includes the option of calling a LABEL if you use
  2950. ONERROR CALL.  This option of ONERROR can also call a PROCEDURE. 
  2951. If you call a LABEL, include a RETURN command at the end of the
  2952. commands to be executed by the specified LABEL.  This will return
  2953. the macro execution to the command immediately following the
  2954. command most recently executed when the Error occurred.  
  2955.  
  2956. Syntax:        ONERROR(Label)
  2957.                or
  2958.                ONERROR CALL (Label)
  2959.  
  2960. Parameters:    Label
  2961.                The label must correspond to a LABEL command
  2962.                within the macro.  If using ONERROR CALL, this
  2963.                parameter can be a PROCEDURE.
  2964.  
  2965. See Also:      ASSERT
  2966.                LABEL
  2967.                ONCANCEL
  2968.                ONNOTFOUND
  2969.                PROCEDURE
  2970.                RETURN
  2971.                              ────  ──── For Example...
  2972.  
  2973. This macro prompts the user to highlight text in a document, and
  2974. the macro assigns it to a variable.
  2975.  
  2976. Display(On!)
  2977. ONERROR(error)
  2978. LABEL(Begin)
  2979. BlockKey
  2980. PROMPT("Highlight the text to assign to a variable and press
  2981. Enter")
  2982. PAUSE
  2983. x:=?BlockedText
  2984.  
  2985. IF (x="")
  2986.   ASSERT(ErrorCondition!)
  2987. ENDIF
  2988.             //the user must place more code here to make
  2989. QUIT           //this macro more functional
  2990.  
  2991. LABEL(Error)
  2992. BEEP
  2993. DisplayRewrite
  2994. PROMPT("You must select text to assign it to a variable")
  2995. PAUSE
  2996. GO(Begin)
  2997. ONNOTFOUND
  2998.  
  2999. Show Me An Example...
  3000. ─────────────────────────────────────────────────────────────────
  3001. ONNOTFOUND directs macro execution to a specified LABEL command
  3002. when a Not Found condition occurs.  Macro execution is directed
  3003. to the LABEL command specified in the last encountered ONNOTFOUND
  3004. command.  If an ONNOTFOUND command has not been encountered when
  3005. a Not Found condition occurs, the macro will stop.
  3006.  
  3007. ONNOTFOUND also includes the option of calling a LABEL if you use
  3008. ONNOTFOUND CALL.  This option of ONNOTFOUND can also call a
  3009. PROCEDURE.  If you call a LABEL, include a RETURN command at the
  3010. end of the commands to be executed by the specified LABEL.  This
  3011. will return the macro execution to the command immediately
  3012. following the command most recently executed when the Not Found
  3013. occurred.  
  3014.  
  3015. Syntax:        ONNOTFOUND(Label)
  3016.                or
  3017.                ONNOTFOUND CALL (Label)
  3018.  
  3019. Parameters:    Label
  3020.                The label must correspond to a LABEL command
  3021.                within the macro.  If using ONNOTFOUND CALL, this
  3022.                parameter can be a PROCEDURE.
  3023.  
  3024. See Also:      ASSERT
  3025.                LABEL
  3026.                ONCANCEL
  3027.                ONERROR
  3028.                PROCEDURE
  3029.                RETURN
  3030.                              ────  ──── For Example...
  3031.  
  3032. This macro searches for a period (.) followed by two spaces and
  3033. capitalizes the first letter of the next sentence.
  3034.  
  3035. DISPLAY(Off!)
  3036. PosDocTop
  3037. CALL(Convert)
  3038.  
  3039. ONNOTFOUND(NotFnd)
  3040. LABEL(Begin)
  3041. SearchString(".  ")
  3042. SearchNext
  3043. CALL(Convert)
  3044. GO(Begin)
  3045.  
  3046. LABEL(Convert)
  3047. BlockOn(CharMode!)
  3048. PosCharNext
  3049. ConvertCaseUppercase
  3050. BlockOff
  3051. RETURN
  3052.  
  3053. LABEL(NotFnd)
  3054. DISPLAY(On!)
  3055. PROMPT("It's finished.  Press ENTER to continue.")
  3056. PAUSE
  3057. PosDocTop
  3058. OR
  3059.  
  3060. Show Me An Example...
  3061. ─────────────────────────────────────────────────────────────────
  3062. OR is an operator that evaluates at least two expressions in a
  3063. conditional statement.  Conditional statements are created with
  3064. commands such as IF, REPEAT, and WHILE.  This operator performs a
  3065. logical OR that evaluates a conditional statement as true if at
  3066. least one expression is true.
  3067.  
  3068. Parameters:    None
  3069.  
  3070. See Also:      AND
  3071.                DIV
  3072.                IF
  3073.                NOT
  3074.                REPEAT
  3075.                WHILE
  3076.                XOR
  3077.                              ────  ──── For Example...
  3078.  
  3079. This macro parses an array and displays the student name and
  3080. grade.
  3081.  
  3082. student[1]:="Mark B.  PE 132  A"
  3083. student[2]:="Kerry R.  Physics 305  B"
  3084. student[3]:="Ralph D.  CS 351  A"
  3085. student[4]:="John B.  Math 402  B"
  3086.  
  3087. FORNEXT(x;1;4;1)
  3088.    len:=STRLEN(student[x])
  3089.    namepos:=STRPOS(student[x];" ")
  3090.    IF((len=0) OR (namepos=0))
  3091.       NEXT
  3092.       name:="xxx"
  3093.    ENDIF
  3094.    name:=SUBSTR(student[x];1;namepos-1)
  3095.    grade:=SUBSTR(student[x];len;1)
  3096.    Type(name)
  3097.    FORNEXT(space;1;15-namepos;1)
  3098.       Type(" ")
  3099.    ENDFOR
  3100.    Type(grade)
  3101.    HRt
  3102. ENDFOR
  3103.  
  3104.  
  3105. PAUSE
  3106.  
  3107. Show Me An Example...
  3108. ─────────────────────────────────────────────────────────────────
  3109. PAUSE pauses a macro until Enter is pressed while in a document
  3110. or the command specified in PAUSESET is pressed.  This command
  3111. enables the user to type text or press keystrokes as if there
  3112. were no macro running.  PAUSE does not prompt the user so this
  3113. command is generally used in conjunction with PROMPT,
  3114. STATUSPROMPT, or BEEP.
  3115.  
  3116. Syntax:        PAUSE
  3117.  
  3118. Parameters:    None
  3119.  
  3120. See Also:      BEEP
  3121.                PAUSECOMMAND
  3122.                PAUSEKEY
  3123.                PAUSESET
  3124.                PROMPT
  3125.                STATUSPROMPT
  3126.                              ────  ──── For Example...
  3127.  
  3128. This macro searches for a period (.) followed by two spaces and
  3129. capitalizes the first letter of the next sentence.
  3130.  
  3131. DISPLAY(Off!)
  3132. PosDocTop
  3133. CALL(Convert)
  3134.  
  3135. ONNOTFOUND(NotFnd)
  3136. LABEL(Begin)
  3137. SearchString(".  ")
  3138. SearchNext
  3139. CALL(Convert)
  3140. GO(Begin)
  3141.  
  3142. LABEL(Convert)
  3143. BlockOn(CharMode!)
  3144. PosCharNext
  3145. ConvertCaseUppercase
  3146. BlockOff
  3147. RETURN
  3148.  
  3149. LABEL(NotFnd)
  3150. DISPLAY(On!)
  3151. PROMPT("It's finished.  Press ENTER to continue.")
  3152. PAUSE
  3153. PosDocTop
  3154. PAUSECOMMAND
  3155.  
  3156. Show Me An Example...
  3157. ─────────────────────────────────────────────────────────────────
  3158. PAUSECOMMAND pauses a macro until the user executes the specified
  3159. command.  PAUSECOMMAND does not prompt the user, so this command
  3160. is generally used in conjunction with PROMPT, STATUSPROMPT, or
  3161. BEEP.
  3162.  
  3163. Syntax:        PAUSECOMMAND(Command)
  3164.  
  3165. Parameters:    Command
  3166.                A macro command specifying the command to end the
  3167.                pause.  Any product command is valid for this
  3168.                parameter, but a command such as HardReturn would
  3169.                be the most common.
  3170.  
  3171. See Also:      BEEP
  3172.                PAUSE
  3173.                PAUSEKEY
  3174.                PAUSESET
  3175.                PROMPT
  3176.                STATUSPROMPT
  3177.  
  3178.                              ────  ──── For Example...
  3179.  
  3180. This macro nests a macro RTRN_ADD which types a users return
  3181. address.  It then allows the user to fill in the inside address
  3182. and salutation.
  3183.  
  3184. NEST("rtrn_add.wpm")
  3185. Hrt
  3186. Hrt
  3187. STATUSPROMPT("Enter the inside address and press F9 to continue")
  3188. PAUSECOMMAND(EndField)
  3189. Hrt
  3190. Hrt
  3191. Type("Dear ")
  3192. STATUSPROMPT("Enter the salutation and press Enter")
  3193. PAUSE
  3194. STATUSPROMPT("")
  3195. Type(",")
  3196. Hrt
  3197. Hrt
  3198. PAUSEKEY
  3199.  
  3200. Show Me An Example...
  3201. ─────────────────────────────────────────────────────────────────
  3202. PAUSEKEY pauses a macro until the specified key is pressed. 
  3203. PAUSEKEY does not prompt the user so this command is generally
  3204. used in conjunction with PROMPT, STATUSPROMPT, or BEEP.
  3205.  
  3206. Syntax:        PAUSEKEY(Key Name)
  3207.  
  3208. Parameters:    Key Name
  3209.                Specifies the key to end the pause.  There are
  3210.                specific key names assigned to each key.  For a
  3211.                list of the key names see Appendix B in the
  3212.                Appendices section.
  3213.  
  3214. See Also:      BEEP
  3215.                PAUSE
  3216.                PAUSECOMMAND
  3217.                PAUSESET
  3218.                PROMPT
  3219.                STATUSPROMPT
  3220.  
  3221.                              ────  ──── For Example...
  3222.  
  3223. This macro beeps if the current document is blank and displays a
  3224. message.
  3225.  
  3226. DISPLAY(Off!)
  3227. IF(?DocBlank)
  3228.    BEEP
  3229.    DISPLAY(On!)
  3230.    PROMPT("The document is blank.  Press Tab to continue")
  3231.    PAUSEKEY(TabKey)
  3232.    DISPLAY(Off!)
  3233.    QUIT
  3234. ENDIF
  3235. PAUSESET
  3236.  
  3237. Show Me An Example...
  3238. ─────────────────────────────────────────────────────────────────
  3239. PAUSESET specifies the default key for PAUSE and INPUT.  The key
  3240. specified in PAUSESET replaces a hardreturn as the command to end
  3241. a pause.
  3242.  
  3243. Syntax:        PAUSESET(Command)
  3244.  
  3245. Parameters:    Command
  3246.                A macro command specifying the command to end the
  3247.                pause.  Any product command is valid for this
  3248.                parameter, but a command such as HardReturn would
  3249.                be the most common.
  3250.  
  3251. See Also:      INPUT
  3252.                PAUSE
  3253.                PAUSECOMMAND
  3254.                PAUSEKEY
  3255.                              ────  ──── For Example...
  3256.  
  3257. This macro counts keystrokes until the user presses Ctrl-Enter.
  3258.  
  3259. STATUSPROMPT("Press Ctrl+Enter to quit")
  3260. cnt:=0
  3261. REPEAT
  3262.   LOOK(info)
  3263.   IF((info<>0) AND (info<>-8097))
  3264.     cnt:=cnt+1
  3265.     Type(NTOC(info))
  3266.   ENDIF
  3267. UNTIL(info=-8097)
  3268. STATUSPROMPT("")
  3269. PAUSESET(EndFieldKey)
  3270. PROMPT("You pressed "+cnt+" keystrokes.  Press F9 to continue")
  3271. PAUSE
  3272. PERSIST
  3273.  
  3274. Show Me An Example...
  3275. ─────────────────────────────────────────────────────────────────
  3276. PERSIST allows the specified variables to be recognized and
  3277. accessed by other macros, FUNCTIONS, PROCEDURES, and merges. 
  3278. Normally, variables are only recognized, and can only be used, by
  3279. the macro in which they are defined.  PERSIST allows variables to
  3280. be shared among macros during the present session of WordPerfect. 
  3281. Variables Var0 through Var9 persist automatically.  All other
  3282. variables require this command to persist.
  3283.  
  3284. Syntax:        PERSIST(Variable1;Variable2;...VariableN)
  3285.  
  3286. Parameters:    Variable
  3287.                Any variable is valid for this parameter.
  3288.  
  3289. See Also:      ASSIGN
  3290.                DISCARD
  3291.                GLOBAL
  3292.                LOCAL
  3293.                PERSISTALL
  3294.                              ────  ──── For Example...
  3295.  
  3296. This macro assigns the typist's initials to a variable and makes
  3297. it accessible until WordPerfect is exited.
  3298.  
  3299. GetString(init;"Enter the typist's initials.")
  3300. IF(EXISTS(init))
  3301.    PERSIST(init)     //The variable INIT is now accessible in any
  3302.                      macro
  3303. ENDIF             //and/or merge as long as WordPerfect is not
  3304.                   exited.  Access it through a merge with the
  3305.                   VARIABLE command, and access it through a macro
  3306.                                     with a TYPE command.
  3307. PERSISTALL
  3308.  
  3309. Show Me An Example...
  3310. ─────────────────────────────────────────────────────────────────
  3311. PERSISTALL allows all variables in the current macro to be
  3312. recognized and accessed by other macros, FUNCTIONS, PROCEDURES,
  3313. and merges during the present session of WordPerfect.  This
  3314. command takes effect when it is encountered, so only those
  3315. variables defined after this command will be available to other
  3316. macros.  Variables Var0 through Var9 persist automatically.
  3317.  
  3318. Syntax:        PERSISTALL
  3319.  
  3320. Parameters:    None
  3321.  
  3322. See Also:      ASSIGN
  3323.                DISCARD
  3324.                GLOBAL
  3325.                LOCAL
  3326.                PERSIST
  3327.  
  3328.                              ────  ──── For Example...
  3329.  
  3330. This macro prompts the user for a return address and assigns it
  3331. to a series of variables.  It then makes the variables accessible
  3332. until WordPerfect is exited.
  3333.  
  3334. DLGCREATE(x;"Return Address";DLGNoCancel!;;;50;10)
  3335.    DLGCONTROL(CtrlText!;name;"Name";StyInitial!;1;3;37;2)
  3336.    DLGCONTROL(CtrlText!;address;"Street Address";;1;5;27;2)
  3337.    DLGCONTROL(CtrlText!;c;"City, State ZIP ";;1;7;25;2)
  3338. DLGEND
  3339. PERSISTALL
  3340. Prompt("All the variables are now accessible in any
  3341. macro/merge.")
  3342. WAIT(50)
  3343. PRESSKEY
  3344.  
  3345. Show Me An Example...
  3346. ─────────────────────────────────────────────────────────────────
  3347. PRESSKEY executes the specified keystroke.  Normally, PRESSKEY
  3348. will execute the original function of a key even if the key has
  3349. been remapped.  If a key has been remapped through Keyboard
  3350. Layout, you can use PRESSKEY in conjunction with the ?KeyPressed
  3351. system variable to execute the new function of the key.  For the
  3352. list of keys and their numeric equivalents see Appendix A in the
  3353. Appendices section.
  3354.  
  3355. Syntax:        PRESSKEY(Key Value)
  3356.  
  3357. Parameters:    Key Value
  3358.                A numeric expression specifying the numeric
  3359.                equivalent of the keystroke to execute.  This
  3360.                parameter can also contain the ?KeyPressed system
  3361.                variable.
  3362.  
  3363. See Also:      CHAR
  3364.                LOOK
  3365.                              ────  ──── For Example...
  3366.  
  3367. This macro takes the number returned by the CHAR command and
  3368. presses the corresponding key.
  3369.  
  3370. CHAR(x;"Enter a character: ")
  3371. Type("You pressed ")
  3372. PRESSKEY(x)
  3373. PROCEDURE
  3374.  
  3375. Show Me An Example...
  3376. ─────────────────────────────────────────────────────────────────
  3377. PROCEDURE is the opening command for a PROCEDURE-ENDPROC
  3378. definition.  A PROCEDURE is a subroutine to which you can pass
  3379. information.  Unlike a FUNCTION, a PROCEDURE cannot return
  3380. information.  PROCEDURE defines the procedure name and the
  3381. parameter names, and precedes the series of commands to be
  3382. executed when the PROCEDURE is called.  Commands after an ENDPROC
  3383. are ignored, so all PROCEDUREs should be placed at the end of a
  3384. macro.
  3385.  
  3386. Creating and calling a PROCEDURE is much like calling a LABEL. 
  3387. However, unlike a LABEL, information can be passed to the
  3388. PROCEDURE to customize the procedure operation.  If variables are
  3389. used in the PROCEDURE, they must first be made available to the
  3390. PROCEDURE using GLOBAL or PERSIST.  If variables are only to be
  3391. used in the PROCEDURE, use LOCAL in the PROCEDURE definition.
  3392.  
  3393. To call a PROCEDURE, you simply state the procedure name and fill
  3394. in the parameters.  The parameters can contain any expression,
  3395. including variables.  You must pass the same number of parameters
  3396. as originally defined in the PROCEDURE.  Since a PROCEDURE cannot
  3397. return information, it should not be called from within another
  3398. command or conditional statement.  Also, a PROCEDURE cannot be
  3399. called from within another PROCEDURE.
  3400.  
  3401. PROCEDUREs can be in the macro from which they are called, in
  3402. another macro, or they can be combined into a macro file library. 
  3403. This library is a macro that doesn't execute, but simply contains
  3404. PROCEDUREs that may be useful in many macros.  If a PROCEDURE
  3405. isn't defined in the macro that calls it, the USE command must be
  3406. placed in the calling macro to identify which macro contains the
  3407. PROCEDURE.  If you are storing PROCEDUREs in a macro file
  3408. library, the file must be compiled before it can be used.  To
  3409. compile, simply play the macro.
  3410.  
  3411. Syntax:        PROCEDURE
  3412.                ProcedureName(Parameter1;Parameter2;...ParN)
  3413.  
  3414. Parameters:    Procedure Name
  3415.                Specifies the PROCEDURE name.  Although this
  3416.                parameter is usually text, it is not considered a
  3417.                character expression and should not be in quotes.
  3418.  
  3419.                Parameter (optional)
  3420.                Specifies the parameter names to which information
  3421.                will be passed when the PROCEDURE is called.  If
  3422.                no parameters are specified, the PROCEDURE can
  3423.                still be called and executed.
  3424.  
  3425. See Also:      ENDPROC
  3426.                FUNCTION
  3427.                GLOBAL
  3428.                LOCAL
  3429.                PERSIST
  3430.                USE
  3431.                              ────  ──── For Example...
  3432.  
  3433. This macro prompts for a file to retrieve.  It then calls a
  3434. Procedure to retrieve the file.
  3435.  
  3436. GLOBAL(Path;Filename)
  3437. LABEL(Begin)
  3438. GETSTRING(Path;"Enter the Path of the file to retrieve.")
  3439. GETSTRING(Filename;"Enter the filename to retrieve.")
  3440. Retrieve()     //calls the procedure Retrieve
  3441. ERROR(Off!)
  3442. IF(?Name="")
  3443.    GO(Begin)
  3444. ENDIF
  3445.  
  3446. QUIT
  3447.  
  3448. PROCEDURE Retrieve()
  3449.    ONERROR CALL(Error)
  3450.    FileRetrieve(Path+Filename)
  3451. ENDPROC
  3452.  
  3453. LABEL(Error)
  3454. INPUT("The File doesn't exist.  Press Enter to continue")
  3455. RETURN
  3456. PROMPT
  3457.  
  3458. Show Me An Example...
  3459. ─────────────────────────────────────────────────────────────────
  3460. PROMPT displays a temporary prompt on the status line.  The
  3461. prompt is removed when a key is pressed, or the display is
  3462. rewritten.  PROMPT does not pause the macro, so it is usually
  3463. used with PAUSE or WAIT.
  3464.  
  3465. Syntax:        PROMPT("Prompt")
  3466.  
  3467. Parameters:    Prompt
  3468.                A character expression specifying the prompt.
  3469.  
  3470. See Also:      BEEP
  3471.                PAUSE
  3472.                STATUSPROMPT
  3473.                WAIT
  3474.                              ────  ──── For Example...
  3475.  
  3476. This macro searches for a period (.) followed by two spaces and
  3477. capitalizes the first letter of the next sentence.
  3478.  
  3479. DISPLAY(Off!)
  3480. PosDocTop
  3481. CALL(Convert)
  3482.  
  3483. ONNOTFOUND(NotFnd)
  3484. LABEL(Begin)
  3485. SearchString(".  ")
  3486. SearchNext
  3487. CALL(Convert)
  3488. GO(Begin)
  3489.  
  3490. LABEL(Convert)
  3491. BlockOn(CharMode!)
  3492. PosCharNext
  3493. ConvertCaseUppercase
  3494. BlockOff
  3495. RETURN
  3496.  
  3497. LABEL(NotFnd)
  3498. DISPLAY(On!)
  3499. PROMPT("It's finished.  Press ENTER to continue.")
  3500. PAUSE
  3501. PosDocTop
  3502. QUIT
  3503.  
  3504. Show Me An Example...
  3505. ─────────────────────────────────────────────────────────────────
  3506. QUIT stops a macro.  No commands following it are executed.  If
  3507. the current macro was started by another macro, both macros stop. 
  3508. Chained or nested macros will not execute after QUIT occurs.
  3509.  
  3510. Syntax:        QUIT
  3511.  
  3512. Parameters:    None
  3513.  
  3514.                              ────  ──── For Example...
  3515.  
  3516. This macro constantly prompts for a name until Cancel is pressed.
  3517.  
  3518. ONCANCEL CALL(Cancel)
  3519. LABEL(Top)
  3520. Name:=""
  3521. GETSTRING(Name;"Type in a name, (Cancel or Enter) to
  3522. quit";"Name")
  3523. IF(Name="")
  3524.    ASSERT(CancelCondition!)
  3525. ENDIF
  3526. TYPE(Name)
  3527. HRt
  3528. GO(Top)
  3529.  
  3530. LABEL(Cancel)
  3531. CANCEL(Off!)
  3532. CHAR(Selection;"Do you really want to Quit? Y/N")
  3533. SWITCH(TOLOWER(NTOC(Selection)))
  3534.    CASEOF "y" : QUIT
  3535.    CASEOF "n" : CANCEL(On!) RETURN
  3536.    DEFAULT    : GO(Cancel)
  3537. ENDSWITCH
  3538. REPEAT
  3539.  
  3540. Show Me An Example...
  3541. ─────────────────────────────────────────────────────────────────
  3542. REPEAT is the opening command of a REPEAT-UNTIL conditional loop. 
  3543. A REPEAT-UNTIL loop continues to execute all commands between
  3544. REPEAT and UNTIL until the condition set in UNTIL is true.  Since
  3545. the condition is evaluated at the end, a REPEAT-UNTIL loop always
  3546. executes at least once regardless of whether the UNTIL condition
  3547. is true or false.  For information on conditional loops whose
  3548. test expressions are evaluated at the top of the loop, see WHILE
  3549. and ENDWHILE.
  3550.  
  3551. Syntax:        REPEAT
  3552.  
  3553. Parameters:    There are no parameters, but REPEAT is always
  3554.                followed by commands to execute at least once.
  3555.  
  3556. See Also:      ENDWHILE
  3557.                UNTIL
  3558.                WHILE
  3559.                              ────  ──── For Example...
  3560.  
  3561. This macro counts keystrokes until the user presses Ctrl-Enter.
  3562.  
  3563. STATUSPROMPT("Press Ctrl+Enter to quit")
  3564. cnt:=0
  3565. REPEAT
  3566.   LOOK(info)
  3567.   IF((info<>0) AND (info<>-8097))
  3568.     cnt:=cnt+1
  3569.     Type(NTOC(info))
  3570.   ENDIF
  3571. UNTIL(info=-8097)
  3572. STATUSPROMPT("")
  3573. PAUSESET(EndFieldKey)
  3574. PROMPT("You pressed "+cnt+" keystrokes.  Press F9 to continue")
  3575. PAUSE
  3576. RETURN
  3577.  
  3578. Show Me An Example...
  3579. ─────────────────────────────────────────────────────────────────
  3580. RETURN marks the end of a series of commands initiated by LABEL,
  3581. PROCEDURE, or FUNCTION.  This command is usually used in
  3582. conjunction with CALL.  When RETURN is encountered, macro
  3583. execution returns to the command immediately following the
  3584. command that called the LABEL or PROCEDURE.  If RETURN occurs
  3585. within a FUNCTION, it also has the capability of returning
  3586. information from the FUNCTION to the location from which it was
  3587. called.  RETURN is then followed by an expression enclosed in
  3588. parentheses.  The expression contains the value to return to the
  3589. FUNCTION.
  3590.  
  3591. Syntax:        RETURN or RETURN(Expression)
  3592.  
  3593. Parameters:    Expression
  3594.                Any expression is valid for this parameter.  It is
  3595.                often a variable or a parameter name as defined by
  3596.                the FUNCTION to which it is returning.
  3597.  
  3598. See Also:      CALL
  3599.                FUNCTION
  3600.                LABEL
  3601.                ONCANCEL
  3602.                ONERROR
  3603.                ONNOTFOUND
  3604.                PROCEDURE
  3605.                              ────  ──── For Example...
  3606.  
  3607. This macro executes a function from within a TYPE command.
  3608.  
  3609. Prmt:="Would you like to continue?"
  3610. Type ("You pressed "+YesNo(prmt))
  3611.  
  3612. //More code for the macro
  3613. Quit
  3614.  
  3615.  
  3616. FUNCTION YesNo (message)
  3617.    LOCAL(ans)
  3618.    IF (EXISTS(ans))
  3619.       DISCARD(ans)
  3620.    ENDIF
  3621.    LABEL(Begin)
  3622.    CHAR(ans;message+"  Y/N")
  3623.    SWITCH(TOLOWER(NTOC(ans)))
  3624.       CASEOF "y" : ans:="Y"
  3625.       CASEOF "n" : ans:="N"
  3626.       DEFAULT : GO(Begin)
  3627.    ENDSWITCH
  3628.    RETURN(ans)
  3629. ENDFUNC
  3630. RUNUNATTENDED
  3631.  
  3632. ─────────────────────────────────────────────────────────────────
  3633. RUNUNATTENDED allows a macro to continue running even if it
  3634. encounters a situation that requires user input.  Specifically,
  3635. retrieving a password-protected file or trying to read from a
  3636. disk drive not containing a disk both give error messages
  3637. requiring action from the user.  Normally, each of these
  3638. situations will return an error that suspends macro execution
  3639. until the user responds.  However, if RUNUNATTENDED is used, the
  3640. situation is canceled (no response is necessary) and macro
  3641. execution can be redirected with ONERROR.  Without RUNUNATTENDED,
  3642. the macro is suspended until the user responds to the problem.
  3643.  
  3644. Syntax:        RUNUNATTENDED(State)
  3645.  
  3646. Parameters:    State
  3647.                Specifies whether critical problems are canceled.
  3648.  
  3649.                Enumerated     Numeric     Description
  3650.                Type           Equivalent
  3651.                ═════════════════════════════════════════════════
  3652.                Off!           0           Critical problems are
  3653.                                           not canceled; response
  3654.                                           required
  3655.                On!            1           Critical problems are
  3656.                                           canceled; no response
  3657.                                           required
  3658.                ═════════════════════════════════════════════════
  3659.  
  3660. See Also:      ONERROR
  3661.                              ────  ────
  3662. SAVESTATE
  3663.  
  3664. Show Me An Example...
  3665. ─────────────────────────────────────────────────────────────────
  3666. SAVESTATE saves the current state of certain WordPerfect features
  3667. and returns back to that state should a macro change it. 
  3668. SAVESTATE automatically saves the state of Autocode Placement,
  3669. Replace Confirm, and WP51 Cursor Movement.
  3670.  
  3671. Syntax:        SAVESTATE
  3672.  
  3673. Parameters:    None
  3674.  
  3675.                              ────  ──── For Example...
  3676.  
  3677. This macro prompts for and sets top and bottom margins.
  3678.  
  3679. SAVESTATE
  3680. AutoCodePlacement(On!)
  3681. SetupSave
  3682. GETUNITS(margint;"Enter top margin";"Margin")
  3683. GETUNITS(marginb;"Enter bottom margin";"Margin")
  3684. MarginTop(margint)
  3685. MarginBottom(marginb)
  3686. SHELLASSIGN
  3687.  
  3688. Show Me An Example...
  3689. ─────────────────────────────────────────────────────────────────
  3690. SHELLASSIGN assigns an expression to a Shell variable to be used
  3691. in a Shell macro.
  3692.  
  3693. Syntax:        SHELLASSIGN(Variable;Expression)
  3694.  
  3695. Parameters:    Variable
  3696.                Specifies the name of the variable to be assigned. 
  3697.                Any variable name is valid for this parameter.
  3698.  
  3699.                Expression
  3700.                Specifies the expression to assign to the
  3701.                variable.  All expressions are valid for this
  3702.                parameter.
  3703.  
  3704. See Also:      SHELLMACRO
  3705.                SHELLVARIABLE
  3706.                              ────  ──── For Example...
  3707.  
  3708. This macro takes a shell variable and retrieves the respective
  3709. file.  The macro then places the path and filename in a footer,
  3710. re-assigns the shell variable and runs a shell macro named
  3711. WPPRINT.SHM.
  3712.  
  3713. WPVar:=SHELLVARIABLE(Name)
  3714. FileRetrieve(WPVar)
  3715. FooterB(Create!)
  3716.    Type(?Path+?Name)
  3717.    SubstructureExit
  3718. path:=?path
  3719. FileSave(Path+"WP.PRN")
  3720. SHELLASSIGN(Name;"WP.PRN")
  3721. SHELLMACRO("C:\OFFICE4\MACROS\WPPRINT.SHM")
  3722. SHELLMACRO
  3723.  
  3724. Show Me An Example...
  3725. ─────────────────────────────────────────────────────────────────
  3726. SHELLMACRO runs the specified Shell macro at the point this
  3727. command is encountered.  An .SHM extension is not required, and
  3728. the path is necessary only if the macro is not located in the
  3729. directory specified in the Location of Macro Files in Shell
  3730. Setup.
  3731.  
  3732. Syntax:        SHELLMACRO("Macro")
  3733.  
  3734. Parameters:    Macro
  3735.                A character expression specifying the Shell macro
  3736.                to run.
  3737.  
  3738. See Also:      SHELLASSIGN
  3739.                SHELLVARIABLE
  3740.                              ────  ──── For Example...
  3741.  
  3742. See example for SHELLASSIGN
  3743. SHELLVARIABLE
  3744.  
  3745. Show Me An Example...
  3746. ─────────────────────────────────────────────────────────────────
  3747. SHELLVARIABLE returns the contents of a Shell variable.  Variable
  3748. contents can either be typed, evaluated, or assigned to a
  3749. WordPerfect variable.
  3750.  
  3751. Syntax:        SHELLVARIABLE(Variable)
  3752.  
  3753. Parameters:    Variable
  3754.                Specifies the name of the Shell variable.
  3755.  
  3756. See Also:      ASSIGN
  3757.                SHELLASSIGN
  3758.                SHELLMACRO
  3759.                Type
  3760.                              ────  ──── For Example...
  3761.  
  3762. See example for SHELLASSIGN
  3763. SHOWATTROFF
  3764.  
  3765. Show Me An Example...
  3766. ─────────────────────────────────────────────────────────────────
  3767. SHOWATTROFF turns off a character display attribute.  This
  3768. command is used in conjunction with SHOWTEXT to change the
  3769. display attributes.
  3770.  
  3771. Syntax:        SHOWATTROFF(Attribute)
  3772.  
  3773. Parameters:    Attribute
  3774.                Specifies the display attribute to turn off. 
  3775.                SHOWATTROFF requires at least one Attribute
  3776.                parameter, but will accept as many as need to be
  3777.                turned off.  Select an enumerated type or its
  3778.                numeric equivalent.
  3779.  
  3780.                Enumerated        Numeric        Description
  3781.                Type              Equivalent
  3782.                ═════════════════════════════════════════════════
  3783.                ExtraLarge!       0              Turns off Extra
  3784.                                                 Large
  3785.                VeryLarge!        1              Turns off Very
  3786.                                                 Large
  3787.                Large!               2              Turns off
  3788.                                                    Large
  3789.                Small!               3              Turns off
  3790.                                                    Small
  3791.                Fine!             4              Turns off Fine
  3792.                Superscript!         5              Turns off
  3793.                                                    Superscript
  3794.                Subscript!        6              Turns off
  3795.                                                 Subscript
  3796.                Outline!          7              Turns off Outline
  3797.                Italics!          8              Turns off Italics
  3798.                Shadow!           9              Turns off Shadow
  3799.                Redline!          10             Turns off Redline
  3800.                DoubleUnderline!     11             Turns off
  3801.                                                    Double
  3802.                                                    Underline
  3803.                Bold!             12             Turns off Bold
  3804.                Strikeout!        13             Turns off
  3805.                                                 Strikeout
  3806.                Underline!        14             Turns off
  3807.                                                 Underline
  3808.                SmallCaps!        15             Turns off Small
  3809.                                                 Caps
  3810.                Every!               16             Turns off
  3811.                                                    every display
  3812.                                                    attribute
  3813.                ═════════════════════════════════════════════════
  3814.  
  3815. See Also:      SHOWATTRON
  3816.                SHOWCODE
  3817.                SHOWCOLOR
  3818.                SHOWPOSITION
  3819.                SHOWTEXT
  3820.                              ────  ──── For Example...
  3821.  
  3822. This macro displays a menu created with the Show commands.
  3823.  
  3824. SHOWPOSITION(0; -1)
  3825. SHOWCODE(ReverseOff!)
  3826. SHOWCOLOR(On!)
  3827. SHOWCODE(ClrScreen!) 
  3828. SHOWPOSITION(21;8)  SHOWTEXT("╔══════════════════════════╗") 
  3829. SHOWPOSITION(21;9)  SHOWTEXT("║     Please select the    ║") 
  3830. SHOWPOSITION(21;10) SHOWTEXT("║     desired recipient    ║") 
  3831. SHOWPOSITION(21;11) SHOWTEXT("║        ")
  3832. SHOWATTRON(Bold!)   SHOWTEXT("1")  SHOWATTROFF(Bold!)
  3833. SHOWTEXT(". ")      SHOWATTRON(Bold!) SHOWTEXT("F")
  3834. SHOWATTROFF(Bold!)  SHOWTEXT("red") SHOWTEXT("           ║") 
  3835. SHOWPOSITION(21;12) SHOWTEXT("║        ")
  3836. SHOWATTRON(Bold!)   SHOWTEXT("2") SHOWATTROFF(Bold!)
  3837. SHOWTEXT(". ")      SHOWATTRON(Bold!) SHOWTEXT("M")
  3838. SHOWATTROFF(Bold!)  SHOWTEXT("ary") SHOWTEXT("           ║") 
  3839. SHOWPOSITION(21;13) SHOWTEXT("║                          ║") 
  3840. SHOWPOSITION(21;14) SHOWTEXT("╚══════════════════════════╝") 
  3841. SHOWPOSITION(1; 24)
  3842.  
  3843. CHAR(menu1;"Selection: ")
  3844. DisplayRewrite
  3845. SHOWATTRON
  3846.  
  3847. Show Me An Example...
  3848. ─────────────────────────────────────────────────────────────────
  3849. SHOWATTRON turns on a character display attribute.  This command
  3850. is used in conjunction with SHOWTEXT to change the display
  3851. attributes of text being displayed.
  3852.  
  3853. Syntax:        SHOWATTRON(Attribute;Attribute;...Atr)
  3854.  
  3855. Parameters:    Attribute
  3856.                Specifies the display attribute to turn on. 
  3857.                SHOWATTRON requires at least one Attribute
  3858.                parameter, but will accept as many as need to be
  3859.                turned on.  Select an enumerated type or its
  3860.                numeric equivalent.
  3861.  
  3862.                Enumerated        Numeric        Description
  3863.                Type              Equivalent
  3864.                ═════════════════════════════════════════════════
  3865.                ExtraLarge!       0              Turns on Extra
  3866.                                                 Large
  3867.                VeryLarge!        1              Turns on Very
  3868.                                                 Large
  3869.                Large!               2              Turns on Large
  3870.                Small!               3              Turns on Small
  3871.                Fine!             4              Turns on Fine
  3872.                Superscript!         5              Turns on
  3873.                                                    Superscript
  3874.                Subscript!        6              Turns on
  3875.                                                 Subscript
  3876.                Outline!          7              Turns on Outline
  3877.                Italics!          8              Turns on Italics
  3878.                Shadow!           9              Turns on Shadow
  3879.                Redline!          10             Turns on Redline
  3880.                DoubleUnderline!     11             Turns on
  3881.                                                    Double
  3882.                                                    Underline
  3883.                Bold!             12             Turns on Bold
  3884.                Strikeout!        13             Turns on
  3885.                                                 Strikeout
  3886.                Underline!        14             Turns on
  3887.                                                 Underline
  3888.                SmallCaps!        15             Turns on Small
  3889.                                                 Caps
  3890.                Every!               16             Turns on every
  3891.                                                    display
  3892.                                                    attribute
  3893.                ═════════════════════════════════════════════════
  3894.  
  3895. See Also:      SHOWATTROFF
  3896.                SHOWCODE
  3897.                SHOWCOLOR
  3898.                SHOWPOSITION
  3899.                SHOWTEXT
  3900.                              ────  ──── For Example...
  3901.  
  3902. See example for SHOWATTROFF
  3903. SHOWCODE
  3904.  
  3905. Show Me An Example...
  3906. ─────────────────────────────────────────────────────────────────
  3907. SHOWCODE positions displayed text and allows for other display
  3908. changes.  A SHOWCODE command affects the next occurence of a
  3909. SHOWTEXT command in the macro.
  3910.  
  3911. Syntax:        SHOWCODE(Code)
  3912.  
  3913. Parameters:    Code
  3914.                Specifies the display change.  Select an
  3915.                enumerated type or its numeric equivalent.
  3916.  
  3917.                Enumerated        Numeric        Description
  3918.                Type              Equivalent
  3919.                ═════════════════════════════════════════════════
  3920.                PosHome!          0              Displays text at
  3921.                                                 upper left of
  3922.                                                 document window
  3923.                PosNextLine!         1              Displays text
  3924.                                                    on the next
  3925.                                                    line
  3926.                PosBegLine!       2              Displays text at
  3927.                                                 the beginning of
  3928.                                                 the current line
  3929.                PosLeft!          3              Moves back to the
  3930.                                                 last SHOWTEXT
  3931.                PosRight!            4              Displays text
  3932.                                                    two spaces to
  3933.                                                    the right of
  3934.                                                    the last
  3935.                                                    SHOWTEXT
  3936.                PosUp!               5              Displays text
  3937.                                                    one line up
  3938.                                                    from the last
  3939.                                                    SHOWTEXT
  3940.                PosDown!          6              Displays text one
  3941.                                                 line down from
  3942.                                                 the last SHOWTEXT
  3943.                ClrLine!          7              Clears the line
  3944.                                                 from the end of
  3945.                                                 the last SHOWTEXT
  3946.                ClrScreen!        8              Clears the screen
  3947.                AttrNormal!       9              Clears all
  3948.                                                 attributes
  3949.                AttrMnemonic!        10             Turns on the
  3950.                                                    Mnemonic
  3951.                                                    attribute for
  3952.                                                    the next
  3953.                                                    character
  3954.                ReverseOn!        11             Turns on Reverse
  3955.                                                 Video
  3956.                ReverseOff!       12             Turns off Reverse
  3957.                                                 Video
  3958.                SaveScreen!       13             Saves the screen
  3959.                RestoreScreen!    14             Restores the
  3960.                                                 screen
  3961.                ═════════════════════════════════════════════════
  3962.  
  3963. See Also:      SHOWATTROFF
  3964.                SHOWATTRON
  3965.                SHOWCOLOR
  3966.                SHOWPOSITION
  3967.                SHOWTEXT
  3968.                              ────  ──── For Example...
  3969.  
  3970. See example for SHOWATTROFF
  3971. SHOWCOLOR
  3972.  
  3973. Show Me An Example...
  3974. ─────────────────────────────────────────────────────────────────
  3975. SHOWCOLOR turns a color scheme on or off.
  3976.  
  3977. Syntax:        SHOWCOLOR(State;"Scheme Name")
  3978.  
  3979. Parameters:    State
  3980.                Specifies whether the color scheme is on or off. 
  3981.                Select an enumerated type or its numeric
  3982.                equivalent
  3983.  
  3984.                Enumerated     Numeric        Description
  3985.                Type           Equivalent
  3986.                ═════════════════════════════════════════════════
  3987.                Off!           0              Turns off color
  3988.                                              scheme
  3989.                On!            1              Turns on color
  3990.                                              scheme
  3991.                ═════════════════════════════════════════════════
  3992.  
  3993.                Scheme Name (optional)
  3994.                A character expression specifying the scheme name
  3995.                to turn on.  This parameter is not required when
  3996.                turning a scheme off.
  3997.  
  3998. See Also:      SHOWATTROFF
  3999.                SHOWATTRON
  4000.                SHOWCODE
  4001.                SHOWPOSITION
  4002.                SHOWTEXT
  4003.  
  4004.                              ────  ──── For Example...
  4005.  
  4006. See example for SHOWATTROFF
  4007. SHOWPOSITION
  4008.  
  4009. Show Me An Example...
  4010. ─────────────────────────────────────────────────────────────────
  4011. SHOWPOSITION positions the cursor on the screen and, optionally,
  4012. displays a temporary prompt.  SHOWPOSITION does not pause the
  4013. macro, so it is used in conjunction with such commands as PAUSE
  4014. or WAIT.
  4015.  
  4016. Syntax:        SHOWPOSITION(Horizontal Position;Vertical
  4017.                Position;"Prompt")Parameters:    Horizontal
  4018.                                                 Position
  4019.                A numeric expression specifying the horizontal
  4020.                position of the prompt.  This position is measured
  4021.                in columns, with 0 representing the first column
  4022.                at the left of the screen.
  4023.  
  4024.                Vertical Position
  4025.                A numeric expression specifying the vertical
  4026.                position of the prompt.  This position is measured
  4027.                in lines, with 0 representing the first row at the
  4028.                top of the screen.
  4029.  
  4030.                Prompt (optional)
  4031.                A character expression specifying the prompt to
  4032.                display.
  4033.  
  4034. See Also:      PAUSE
  4035.                SHOWATTROFF
  4036.                SHOWATTRON
  4037.                SHOWCODE
  4038.                SHOWCOLOR
  4039.                SHOWTEXT
  4040.                WAIT
  4041.  
  4042.                              ────  ──── For Example...
  4043.  
  4044. See example for SHOWATTROFF
  4045. SHOWTEXT
  4046.  
  4047. Show Me An Example...
  4048. ─────────────────────────────────────────────────────────────────
  4049. SHOWTEXT displays a temporary prompt a specified number of times. 
  4050. SHOWPOSITION does not pause the macro, so it is used in
  4051. conjunction with commands such as PAUSE or WAIT.
  4052.  
  4053. Syntax:        SHOWTEXT("Prompt";Count)
  4054.  
  4055. Parameters:    Prompt
  4056.                A character expression specifying the prompt to
  4057.                display.
  4058.  
  4059.                Count (optional)
  4060.                A numeric expression specifying the number of
  4061.                times to display the prompt.  If this parameter is
  4062.                not specified, the prompt will display once.
  4063.  
  4064. See Also:      PAUSE
  4065.                SHOWATTROFF
  4066.                SHOWATTRON
  4067.                SHOWPOSITION
  4068.                SHOWCODE
  4069.                SHOWCOLOR
  4070.                WAIT
  4071.  
  4072.                              ────  ──── For Example...
  4073.  
  4074. See example for SHOWATTROFF
  4075. SPEED
  4076.  
  4077. Show Me An Example...
  4078. ─────────────────────────────────────────────────────────────────
  4079. SPEED slows down macro execution while writing to the screen. 
  4080. Macro speed is incremented in tenths of a second.  For example,
  4081. to specify a macro to wait one-half second, the command is
  4082. SPEED(5).  The maximum delay is one minute or SPEED(600).  The
  4083. default macro speed is SPEED(0).  SPEED is useful for debugging
  4084. macros or making demonstration macros.
  4085.  
  4086. Syntax:        SPEED(Tenths of a Second)
  4087.  
  4088. Parameters:    Tenths of a Second
  4089.                A numeric expression between 0 and 600 specifying
  4090.                macro speed.
  4091.  
  4092. See Also:      PAUSE
  4093.                WAIT
  4094.                              ────  ──── For Example...
  4095.  
  4096. This macro displays how the SPEED command slows down the
  4097. execution of a macro.
  4098.  
  4099. FORNEXT(Count;1;20)
  4100. TYPE("This is line "+Count+".")
  4101. HRt
  4102. ENDFOR
  4103. SPEED(30)
  4104. FORNEXT(Count;1;20)
  4105. TYPE("This is line "+Count+".")
  4106. HRt
  4107. ENDFOR
  4108. STATUSPROMPT
  4109.  
  4110. Show Me An Example...
  4111. ─────────────────────────────────────────────────────────────────
  4112. STATUSPROMPT displays a prompt on the status line.  The prompt is
  4113. stored in memory much like a variable and will continue to
  4114. display until it is replaced by another prompt using either INPUT
  4115. or another STATUSPROMPT command.  If the prompt is not replaced,
  4116. it will remain visible until it is cleared by a blank INPUT or
  4117. STATUSPROMPT or until you exit WordPerfect.  STATUSPROMPT does
  4118. not pause the macro.  To pause the macro until a specific key or
  4119. command is executed, use PAUSE, PAUSECOMMAND, or PAUSEKEY.  To
  4120. display the prompt for a specific amount of time, use WAIT.
  4121.  
  4122. Syntax:        STATUSPROMPT("Prompt")
  4123.  
  4124. Parameters:    Prompt
  4125.                A character expression specifying the prompt to
  4126.                display.
  4127.  
  4128. See Also:      PAUSE
  4129.                PAUSECOMMAND
  4130.                PAUSEKEY
  4131.                WAIT
  4132.                              ────  ──── For Example...
  4133.  
  4134. This macro counts keystrokes until the user presses Ctrl-Enter.
  4135.  
  4136. STATUSPROMPT("Press Ctrl+Enter to quit")
  4137. cnt:=0
  4138. REPEAT
  4139.   LOOK(info)
  4140.   IF((info<>0) AND (info<>-8097))
  4141.     cnt:=cnt+1
  4142.     Type(NTOC(info))
  4143.   ENDIF
  4144. UNTIL(info=-8097)
  4145. STATUSPROMPT("")
  4146. PAUSESET(EndFieldKey)
  4147. PROMPT("You pressed "+cnt+" keystrokes.  Press F9 to continue")
  4148. PAUSE
  4149. STEP
  4150.  
  4151. Show Me An Example...
  4152. ─────────────────────────────────────────────────────────────────
  4153. STEP executes a macro one step at a time and is useful for
  4154. debugging macros.  When STEP is turned on a dialog box offers
  4155. debugging options.  If you choose Step, the macro will execute
  4156. the next command.  Choosing List displays a list of all
  4157. encountered variables and their contents.  From this list you can
  4158. choose which variable table to list (Local, Global, or
  4159. Persistent).  If you choose Run, the macro will begin executing
  4160. and STEP will be turned off.  Choosing Cancel will cancel STEP
  4161. and macro execution.
  4162.  
  4163. Syntax:        STEP(State)
  4164.  
  4165. Parameters:    State
  4166.                Specifies whether STEP is on.  Select an
  4167.                enumerated type or its numeric equivalent.
  4168.  
  4169.                Enumerated     Numeric     Description
  4170.                Type           Equivalent
  4171.                ═════════════════════════════════════════════════
  4172.                Off!           0           Turns STEP off
  4173.                On!            1           Turns STEP on
  4174.                ═════════════════════════════════════════════════
  4175.  
  4176.                              ────  ──── For Example...
  4177.  
  4178. This macro demonstrates how the STEP command works.  The STEP
  4179. command is mainly used for debugging purposes.
  4180.  
  4181. FORNEXT(Count;1;5)
  4182. TYPE("This is line "+Count+".")
  4183. HRt
  4184. ENDFOR
  4185.  
  4186. STEP(On!)
  4187.  
  4188. FORNEXT(Count;1;5)
  4189. TYPE("This is line "+Count+".")
  4190. HRt
  4191. ENDFOR
  4192. STRLEN
  4193.  
  4194. Show Me An Example...
  4195. ─────────────────────────────────────────────────────────────────
  4196. STRLEN returns the number of characters (length), of a character
  4197. expression.  This command is used in conjunction with commands
  4198. that can evaluate its contents or perform an action such as IF,
  4199. ASSIGN, or Type.
  4200.  
  4201. Syntax:        STRLEN("String")
  4202.  
  4203. Parameters:    String
  4204.                A character expression or a variable containing a
  4205.                character expression to evaluate.
  4206.  
  4207. See Also:      ASSIGN
  4208.                IF
  4209.                NUMSTR
  4210.                STRNUM
  4211.                STRPOS
  4212.                STRUNIT
  4213.                Type
  4214.                              ────  ──── For Example...
  4215.  
  4216. This macro parses an array and displays the student name and
  4217. grade.
  4218.  
  4219. student[1]:="Mark B.  PE 132  A"
  4220. student[2]:="Kerry R.  Physics 305  B"
  4221. student[3]:="Ralph D.  CS 351  A"
  4222. student[4]:="John B.  Math 402  B"
  4223.  
  4224. FORNEXT(x;1;4;1)
  4225.    len:=STRLEN(student[x])
  4226.    namepos:=STRPOS(student[x];" ")
  4227.    IF((len=0) OR (namepos=0))
  4228.       NEXT
  4229.       name:="xxx"
  4230.    ENDIF
  4231.    name:=SUBSTR(student[x];1;namepos-1)
  4232.    grade:=SUBSTR(student[x];len;1)
  4233.    Type(name)
  4234.    FORNEXT(space;1;15-namepos;1)
  4235.       Type(" ")
  4236.    ENDFOR
  4237.    Type(grade)
  4238.    HRt
  4239. ENDFOR
  4240. STRNUM
  4241.  
  4242. Show Me An Example...
  4243. ─────────────────────────────────────────────────────────────────
  4244. STRNUM converts a character expression to a numeric expression. 
  4245. This command must be used in an expression and must be used in
  4246. conjunction with commands that evaluate expressions, such as IF,
  4247. ASSIGN or Type.
  4248.  
  4249. Syntax:        STRNUM("String")
  4250.  
  4251. Parameters:    String
  4252.                A character expression specifying the text to
  4253.                convert.
  4254.  
  4255. See Also:      ASSIGN
  4256.                NUMSTR
  4257.                STRLEN
  4258.                STRPOS
  4259.                STRUNIT
  4260.                Type
  4261.  
  4262.                              ────  ──── For Example...
  4263.  
  4264. This macro takes the string 15 and displays it as a Number, Unit
  4265. and Unit String value.
  4266.  
  4267. Num:="15"
  4268. ASSIGN(Number;STRNUM(Num))
  4269. ASSIGN(Unit;STRUNIT(Num))
  4270. ASSIGN(UnitString;UNITSTR(Unit;Centimeters!))
  4271.  
  4272. TYPE("The Number value is "+ Number)
  4273. HRt
  4274. TYPE("The Unit value is "+ Unit)
  4275. HRt
  4276. TYPE("The Unit String value is "+ UnitString)
  4277. HRt
  4278. STRPOS
  4279.  
  4280. Show Me An Example...
  4281. ─────────────────────────────────────────────────────────────────
  4282. STRPOS returns the position of a substring within an original
  4283. string.  For example, "Perfect" is a substring of "WordPerfect"
  4284. and begins at the fifth character, or position.  In this example,
  4285. STRPOS returns a value of 5.  This command is used in conjunction
  4286. with commands that can evaluate its contents or perform an action
  4287. such as ASSIGN, IF, or Type.  If a substring is not found, STRPOS
  4288. returns the value of 0.
  4289.  
  4290. Syntax:        STRPOS("Original String";"Substring")
  4291.  
  4292. Parameters:    Original String
  4293.                A character expression specifying the original
  4294.                string.
  4295.  
  4296.                Substring
  4297.                A character expression specifying the substring.
  4298.  
  4299. See Also:      ASSIGN
  4300.                IF
  4301.                NUMSTR
  4302.                STRLEN
  4303.                STRNUM
  4304.                STRUNIT
  4305.                SUBSTR
  4306.                Type
  4307.  
  4308.                              ────  ──── For Example...
  4309.  
  4310. This macro parses an array and displays the student name and
  4311. grade.
  4312.  
  4313. student[1]:="Mark B.  PE 132  A"
  4314. student[2]:="Kerry R.  Physics 305  B"
  4315. student[3]:="Ralph D.  CS 351  A"
  4316. student[4]:="John B.  Math 402  B"
  4317.  
  4318. FORNEXT(x;1;4;1)
  4319.    len:=STRLEN(student[x])
  4320.    namepos:=STRPOS(student[x];" ")
  4321.    IF((len=0) OR (namepos=0))
  4322.       NEXT
  4323.       name:="xxx"
  4324.    ENDIF
  4325.    name:=SUBSTR(student[x];1;namepos-1)
  4326.    grade:=SUBSTR(student[x];len;1)
  4327.    Type(name)
  4328.    FORNEXT(space;1;15-namepos;1)
  4329.       Type(" ")
  4330.    ENDFOR
  4331.    Type(grade)
  4332.    HRt
  4333. ENDFOR
  4334. STRUNIT
  4335.  
  4336. Show Me An Example...
  4337. ─────────────────────────────────────────────────────────────────
  4338. STRUNIT converts a character expression to a measurement
  4339. expression.  This command is used in conjunction with such
  4340. commands as ASSIGN or Type.
  4341.  
  4342. Syntax:        STRUNIT("String")
  4343.  
  4344. Parameters:    String
  4345.                A character expression specifying the text to
  4346.                convert.
  4347.  
  4348. See Also:      ASSIGN
  4349.                NUMSTR
  4350.                STRLEN
  4351.                STRNUM
  4352.                STRPOS
  4353.                Type
  4354.  
  4355.                              ────  ──── For Example...
  4356.  
  4357. This macro takes the string 15 and displays it as a Number, Unit
  4358. and Unit String value.
  4359.  
  4360. Num:="15"
  4361. ASSIGN(Number;STRNUM(Num))
  4362. ASSIGN(Unit;STRUNIT(Num))
  4363. ASSIGN(UnitString;UNITSTR(Unit;Centimeters!))
  4364.  
  4365. TYPE("The Number value is "+ Number)
  4366. HRt
  4367. TYPE("The Unit value is "+ Unit)
  4368. HRt
  4369. TYPE("The Unit String value is "+ UnitString)
  4370. HRt
  4371. SUBSTR
  4372.  
  4373. Show Me An Example...
  4374. ─────────────────────────────────────────────────────────────────
  4375. SUBSTR creates a substring from an existing string.  For example,
  4376. to create substring "Brad" from "Bradford", the command is
  4377. SUBSTR("Bradford";1;4).  The value 1 specifies beginning the
  4378. substring at the first character or position of the original
  4379. string.  The value 4 represents extracting four consecutive
  4380. characters, including the character at the beginning position, to
  4381. create the substring.
  4382.  
  4383. SUBSTR is used in conjunction with commands that can evaluate its
  4384. contents or perform an action such as ASSIGN, IF, and Type.
  4385.  
  4386. Syntax:        SUBSTR("Original String";Beginning Position;Number
  4387.                of Characters)
  4388.  
  4389. Parameters:    Original String
  4390.                A character expression specifying the string from
  4391.                which to create a substring.
  4392.  
  4393.                Beginning Position
  4394.                A numeric expression specifying the number of
  4395.                characters from the left (or at what position) to
  4396.                begin the substring.  This parameter will also
  4397.                accept negative numbers to specify a position
  4398.                beginning at the right.
  4399.  
  4400.                Number of Characters
  4401.                A numeric expression specifying the number
  4402.                characters (including the beginning position) to
  4403.                extract as the substring.
  4404.  
  4405. See Also:      ASSIGN
  4406.                IF
  4407.                NUMSTR
  4408.                STRLEN
  4409.                STRPOS
  4410.                SUBSTR
  4411.                STRUNIT
  4412.                Type
  4413.  
  4414.  
  4415.                              ────  ──── For Example...
  4416.  
  4417. This macro parses an array and displays the student name and
  4418. grade.
  4419.  
  4420. student[1]:="Mark B.  PE 132  A"
  4421. student[2]:="Kerry R.  Physics 305  B"
  4422. student[3]:="Ralph D.  CS 351  A"
  4423. student[4]:="John B.  Math 402  B"
  4424.  
  4425. FORNEXT(x;1;4;1)
  4426.    len:=STRLEN(student[x])
  4427.    namepos:=STRPOS(student[x];" ")
  4428.    IF((len=0) OR (namepos=0))
  4429.       NEXT
  4430.       name:="xxx"
  4431.    ENDIF
  4432.    name:=SUBSTR(student[x];1;namepos-1)
  4433.    grade:=SUBSTR(student[x];len;1)
  4434.    Type(name)
  4435.    FORNEXT(space;1;15-namepos;1)
  4436.       Type(" ")
  4437.    ENDFOR
  4438.    Type(grade)
  4439.    HRt
  4440. ENDFOR
  4441. SWITCH
  4442.  
  4443. Show Me An Example...
  4444. ─────────────────────────────────────────────────────────────────
  4445. SWITCH is the opening command for a conditional switch statement. 
  4446. A complete switch statement includes the following commands: 
  4447. SWITCH, CASEOF, CONTINUE (optional), DEFAULT (optional), and
  4448. ENDSWITCH.  A switch statement compares a single SWITCH
  4449. expression against individual CASEOF expressions and executes
  4450. specific commands depending on which CASEOF matches the SWITCH
  4451. expression.
  4452.  
  4453. The SWITCH command contains an expression to evaluate.  Any
  4454. expression is valid, but it is usually a variable.  In most
  4455. cases, the contents of this variable are assigned earlier in the
  4456. macro with commands such as CHAR or GETSTRING.  This SWITCH
  4457. expression is the "test" against which each individual case is
  4458. compared.  The individual cases are created with the CASEOF
  4459. command.  When an individual CASEOF expression matches the SWITCH
  4460. expression, the macro executes whatever commands follow the
  4461. CASEOF that provided the match.  
  4462.  
  4463. Both the SWITCH and the CASEOF expressions are case sensitive
  4464. (capitalization) and must match exactly.  If none of the CASEOF
  4465. expressions match the SWITCH expression, the macro executes the
  4466. commands between DEFAULT and ENDSWITCH.  If a DEFAULT command is
  4467. not included, the macro is redirected to the commands following
  4468. ENDSWITCH.
  4469.  
  4470. For example,
  4471.  
  4472. LABEL(Question)
  4473.  
  4474. CHAR(YESNO;"Do you have a preference? Y/N")
  4475.  
  4476. SWITCH(NTOC(YESNO))
  4477.    CASEOF "Y";"y":  Type("Yes")
  4478.    CASEOF "N";"n":  Type("No")
  4479.    DEFAULT:    GO(Question)
  4480. ENDSWITCH
  4481.  
  4482. In this example, the CHAR command asks the user a question. The
  4483. user's response is stored in the variable YESNO.  The switch
  4484. statement that follows then evaluates that variable and executes
  4485. appropriate commands depending on the contents of the variable. 
  4486. Specifically, if the variable contains either an uppercase or a
  4487. lowercase "y," the macro types the word "Yes."  If the variable
  4488. YESNO contains either an uppercase or lowercase "n," the macro
  4489. will type the word "No."  If the variable contains anything else,
  4490. the macro returns to label Question and the user will have a
  4491. chance to respond again.  
  4492.  
  4493. The CHAR command only recognizes numbers.  If a character is
  4494. pressed in response to the CHAR command prompt, the character is
  4495. converted to its numeric equivalent.  The NTOC command in the
  4496. switch expression converts the number back to its original
  4497. character.  For a list of characters and their numeric
  4498. equivalents see Appendix A in the Appendices section.
  4499.  
  4500. Syntax:        SWITCH(Expression)
  4501.  
  4502. Parameters:    Expression
  4503.                Specifies the expression to evaluate.  All
  4504.                expressions are valid for this parameter.
  4505.  
  4506. See Also:      CASEOF
  4507.                CHAR
  4508.                CONTINUE
  4509.                DEFAULT
  4510.                ENDSWITCH
  4511.                GETSTRING
  4512.                LABEL
  4513.                NTOC
  4514.                              ────  ──── For Example...
  4515.  
  4516. This macro constantly prompts for a name until Cancel is pressed.
  4517.  
  4518. ONCANCEL CALL(Cancel)
  4519. LABEL(Top)
  4520. Name:=""
  4521. GETSTRING(Name;"Type in a name, (Cancel or Enter) to
  4522. quit";"Name")
  4523. IF(Name="")
  4524.    ASSERT(CancelCondition!)
  4525. ENDIF
  4526. TYPE(Name)
  4527. Hrt
  4528. GO(Top)
  4529.  
  4530. LABEL(Cancel)
  4531. CANCEL(Off!)
  4532. CHAR(Selection;"Do you really want to Quit? Y/N")
  4533. SWITCH(TOLOWER(NTOC(Selection)))
  4534.    CASEOF "y" : QUIT
  4535.    CASEOF "n" : CANCEL(On!) RETURN
  4536.    DEFAULT    : GO(Cancel)
  4537. ENDSWITCH
  4538.  
  4539.  
  4540. TOLOWER
  4541.  
  4542. Show Me An Example...
  4543. ─────────────────────────────────────────────────────────────────
  4544. TOLOWER converts a character expression to lowercase letters. 
  4545. This command is used in conjunction with commands that can
  4546. evaluate its contents or perform an action such as ASSIGN, IF,
  4547. and Type.
  4548.  
  4549. Syntax:        TOLOWER("String")
  4550.  
  4551. Parameters:    String
  4552.                A character expression specifying the text to
  4553.                convert.
  4554.  
  4555. See Also:      ASSIGN
  4556.                IF
  4557.                TOUPPER
  4558.                Type
  4559.                              ────  ──── For Example...
  4560.  
  4561. This macro executes a function from within a TYPE command.
  4562.  
  4563. Prmt:="Would you like to continue?"
  4564. Type ("You pressed "+YesNo(prmt))
  4565.  
  4566. //More code for the macro
  4567. Quit
  4568.  
  4569.  
  4570. FUNCTION YesNo (message)
  4571.    LOCAL(ans)
  4572.    IF (EXISTS(ans))
  4573.       DISCARD(ans)
  4574.    ENDIF
  4575.    LABEL(Begin)
  4576.    CHAR(ans;message+"  Y/N")
  4577.    SWITCH(TOLOWER(NTOC(ans)))
  4578.       CASEOF "y" : ans:="Y"
  4579.       CASEOF "n" : ans:="N"
  4580.       DEFAULT : GO(Begin)
  4581.    ENDSWITCH
  4582.    RETURN(ans)
  4583. ENDFUNC
  4584. TOUPPER
  4585.  
  4586. Show Me An Example...
  4587. ─────────────────────────────────────────────────────────────────
  4588. TOUPPER converts a character expression to uppercase letters. 
  4589. This command is used in conjunction with commands that can
  4590. evaluate its contents or perform an action such as ASSIGN, IF,
  4591. and Type.
  4592.  
  4593. Syntax:        TOUPPER("String")
  4594.  
  4595. Parameters:    String
  4596.                A character expression specifying the text to
  4597.                convert.
  4598.  
  4599. See Also:      ASSIGN
  4600.                IF
  4601.                TOLOWER
  4602.                Type
  4603.  
  4604.                              ────  ──── For Example...
  4605.  
  4606. This macro creates a secondary merge file through a series of
  4607. prompts.
  4608.  
  4609. ASSIGN(More;"Y")
  4610. WHILE(TOUPPER(More)="Y")
  4611.    FOREACH(field;{"First Name";"Last 
  4612.       Name";"Company";"Address";"City";"State";"Zip"})
  4613.       GETSTRING(info;"Enter the "+field;"Field "+field;)
  4614.       TYPE(info)
  4615.       EndField
  4616.       info:=""
  4617.    ENDFOR
  4618.    MergeCode(EndRecord!)
  4619.    CHAR(More;"Enter another record? Y/N")
  4620.    ASSIGN(More;NTOC(More))
  4621. ENDWHILE
  4622. UNITSTR
  4623.  
  4624. Show Me An Example...
  4625. ─────────────────────────────────────────────────────────────────
  4626. UNITSTR converts a measurement expression to a character
  4627. expression.
  4628.  
  4629. Syntax:        UNITSTR(Measurement;Unit of Measurement)
  4630.  
  4631. Parameters:    Measurement
  4632.                A measurement expression specifying the number to
  4633.                convert or a variable containing a measurement
  4634.                expression.
  4635.  
  4636.                Unit of Measurement
  4637.                Specifies the unit of measurement.  Select an
  4638.                enumerated type or its numeric equivalent
  4639.  
  4640.                Enumerated     Numeric     Description
  4641.                Type           Equivalent
  4642.                ═════════════════════════════════════════════════
  4643.                Inches!        0           Converts inches (")
  4644.                InchesI!       1           Converts inches (i)
  4645.                Centimeters!      2           Converts centimeters
  4646.                Millimeters!      3           Converts millimeters
  4647.                Points!        4           Converts points
  4648.                WP1200ths!     5           Converts 1200ths of an
  4649.                                           inch
  4650.                WP42Units!     6           Converts WP 4.2 units
  4651.                ═════════════════════════════════════════════════
  4652.  
  4653.                              ────  ──── For Example...
  4654.  
  4655. This macro takes the string 15 and displays it as a Number, Unit
  4656. and Unit String value.
  4657.  
  4658. Num:="15"
  4659. ASSIGN(Number;STRNUM(Num))
  4660. ASSIGN(Unit;STRUNIT(Num))
  4661. ASSIGN(UnitString;UNITSTR(Unit;Centimeters!))
  4662.  
  4663. TYPE("The Number value is "+ Number)
  4664. HRt
  4665. TYPE("The Unit value is "+ Unit)
  4666. HRt
  4667. TYPE("The Unit String value is "+ UnitString)
  4668. HRt
  4669. UNTIL
  4670.  
  4671. Show Me An Example...
  4672. ─────────────────────────────────────────────────────────────────
  4673. UNTIL is the closing command of a REPEAT-UNTIL loop.  The loop
  4674. continues until the expression in the UNTIL command is true.  For
  4675. example, a macro that counts to ten could use the following
  4676. REPEAT-UNTIL loop:
  4677.  
  4678. ASSIGN(Count;1)
  4679.  
  4680. REPEAT
  4681.    ASSIGN(Count;Count + 1)
  4682. UNTIL(Count=10)
  4683.  
  4684. This example adds 1 to the value of variable Count each time the
  4685. loop repeats.  When Count equals 10, the UNTIL expression is
  4686. satisfied and the loop ends.  The macro then resumes with the
  4687. command immediately following UNTIL.  UNTIL expressions are
  4688. evaluated at the end of the loop.  As a result, a REPEAT-UNTIL
  4689. loop always executes at least once, regardless of whether the
  4690. condition is true or false.  For information on conditional loops
  4691. that evaluate expressions at the beginning, and will not execute
  4692. if the expression is false, see WHILE and ENDWHILE.
  4693.  
  4694. Syntax:        UNTIL(Test)
  4695.  
  4696. Parameters:    Test
  4697.                A relational expression to evaluate.
  4698.  
  4699. See Also:      ENDWHILE
  4700.                REPEAT
  4701.                WHILE
  4702.                              ────  ──── For Example...
  4703.  
  4704. This macro counts keystrokes until the user presses Ctrl-Enter.
  4705.  
  4706. STATUSPROMPT("Press Ctrl+Enter to quit")
  4707. cnt:=0
  4708. REPEAT
  4709.   LOOK(info)
  4710.   IF((info<>0) AND (info<>-8097))
  4711.     cnt:=cnt+1
  4712.     Type(NTOC(info))
  4713.   ENDIF
  4714. UNTIL(info=-8097)
  4715. STATUSPROMPT("")
  4716. PAUSESET(EndFieldKey)
  4717. PROMPT("You pressed "+cnt+" keystrokes.  Press F9 to continue")
  4718. PAUSE
  4719. USE
  4720.  
  4721. Show Me An Example...
  4722. ─────────────────────────────────────────────────────────────────
  4723. USE enables macros to share FUNCTIONs and PROCEDUREs.  This
  4724. command specifies a macro containing a FUNCTIONs and/or
  4725. PROCEDUREs that can be used in the current macro.  USE can
  4726. specify a macro file library (a macro that does not execute, but
  4727. simply contains FUNCTIONs and/or PROCEDUREs), or another
  4728. executable macro.
  4729.  
  4730. Syntax:        USE("Macro")
  4731.  
  4732. Parameters:    Macro
  4733.                A character expression specifying the macro or
  4734.                macro file library to use.
  4735.  
  4736. See Also:      FUNCTION
  4737.                PROCEDURE
  4738.                              ────  ──── For Example...
  4739.  
  4740. This macro uses the function FileExists from the macro
  4741. Library.wpm.
  4742.  
  4743. DISPLAY(Off!)
  4744. USE("Library.wpm")
  4745. LABEL(Begin)
  4746. GetString(flname;"Enter the name of the file")
  4747. rslt:=FileExists("";flname+".doc")  //FileExists is a function in
  4748.                                     //Library.wpm  It returns a
  4749. IF(rslt)                            //boolean (true/false) value.
  4750.   CHAR(ans;"This file already exists.  Overwrite it? y/n")
  4751.   SWITCH(NTOC(ans))
  4752.      CASEOF "Y";"y" : GO(Save)
  4753.      CASEOF "N";"n" : CONTINUE
  4754.      DEFAULT : GO(Begin)
  4755.   ENDSWITCH
  4756. ENDIF
  4757.  
  4758. LABEL(Save)
  4759. FileSave(flname+".doc")
  4760. USERFUNCTION
  4761.  
  4762. Show Me An Example...
  4763. ─────────────────────────────────────────────────────────────────
  4764. USERFUNCTION passes executable strings to a third party program. 
  4765. The string specified depends on the program to which it is being
  4766. passed.
  4767.  
  4768. Syntax:        USERFUNCTION(<Signature>:<Action>)
  4769.  
  4770. Parameters:    Signature
  4771.                Specifies a four-character identification for the
  4772.                third party program.
  4773.  
  4774.                Action
  4775.                Specifies a character string that the third party
  4776.                program can execute.
  4777.  
  4778.                              ────  ──── For Example...
  4779.  
  4780. This command is specific to third-party products such as TSR's. 
  4781. Therefore, no example is supplied since this command will be
  4782. specific to each individual user.
  4783. VARERRCHK
  4784.  
  4785. Show Me An Example...
  4786. ─────────────────────────────────────────────────────────────────
  4787. VARERRCHK determines whether undefined variables cause an error
  4788. message.  By default, undefined variables will generate the error
  4789. "Variable not Assigned a Value" and stops the macro from
  4790. executing further.  Undefined variables can occur in commands,
  4791. such as Type, that use variables to perform an action.  For
  4792. example, the command Type(Number) could generate an error if
  4793. variable Number is not assigned earlier in the macro.  The same
  4794. error is generated if the Type command is meant to type the word
  4795. "Number", but the quotes defining it as a character expression
  4796. are not included.  With VARERRCHK(Off!), a macro will continue
  4797. running even if it contains undefined variables.
  4798.  
  4799. Syntax:        VARERRCHK(State)
  4800.  
  4801. Parameters:    State
  4802.                Specifies whether variable error checking is on. 
  4803.                Select an enumerated type or its numeric
  4804.                equivalent.
  4805.  
  4806.                Enumerated     Numeric     Description
  4807.                Type           Equivalent
  4808.                ═════════════════════════════════════════════════
  4809.                Off!           0           Error checking off
  4810.                On!            1           Error checking on
  4811.                ═════════════════════════════════════════════════
  4812.  
  4813. See Also:      
  4814.                              ────  ──── For Example...
  4815.  
  4816. This macro assigns a name to the variable Name if the variable
  4817. doesn't exist.
  4818.  
  4819. VARERRCHK(Off!)
  4820. IF (Name="")
  4821.    GETSTRING(Name;"Enter your name";"Name")
  4822. TYPE(Name)
  4823. ELSE 
  4824. TYPE(Name) 
  4825. ENDIF
  4826. WAIT
  4827.  
  4828. Show Me An Example...
  4829. ─────────────────────────────────────────────────────────────────
  4830. WAIT suspends macro execution for a specified amount of time. 
  4831. This is useful, for example, to display a prompt on the screen
  4832. for a certain amount of time.  If a user begins typing while the
  4833. macro is suspended, the keystrokes are ignored until the
  4834. specified time has elapsed.  The length of WAIT is specified in
  4835. tenths of a second, with a maximum of one minute, or WAIT(600).
  4836.  
  4837. Syntax:        WAIT(Tenths of a Second)
  4838.  
  4839. Parameters:    Tenths of a Second
  4840.                A numeric expression specifying the amount of time
  4841.                to wait.
  4842.  
  4843. See Also:      PAUSE
  4844.                PROMPT
  4845.                STATUSPROMPT
  4846.                              ────  ──── For Example...
  4847.  
  4848. This macro prompts the user for a return address and assigns it
  4849. to a series of variables.  It then makes the variables accessible
  4850. until WordPerfect is exited.
  4851.  
  4852. DLGCREATE(x;"Return Address";DLGNoCancel!;;;50;10)
  4853.    DLGCONTROL(CtrlText!;name;"Name";StyInitial!;1;3;37;2)
  4854.    DLGCONTROL(CtrlText!;address;"Street Address";;1;5;27;2)
  4855.    DLGCONTROL(CtrlText!;c;"City, State ZIP ";;1;7;25;2)
  4856. DLGEND
  4857. PERSISTALL
  4858. Prompt("All the variables are now accessible in any
  4859. macro/merge.")
  4860. WAIT(50)
  4861. WHILE
  4862.  
  4863. Show Me An Example...
  4864. ─────────────────────────────────────────────────────────────────
  4865. WHILE is the opening command of a WHILE-ENDWHILE loop.  This loop
  4866. repeatedly executes the commands between WHILE and ENDWHILE as
  4867. long as the WHILE expression is true.  The expression is
  4868. evaluated at the top of the loop.  If the expression is false,
  4869. macro execution resumes with the command immediately following
  4870. ENDWHILE.  For information on loops that evaluate expressions at
  4871. the end of the loop, see REPEAT and UNTIL.
  4872.  
  4873. Syntax:        WHILE(Test)
  4874.  
  4875. Parameters:    Test
  4876.                A relational expression to evaluate.
  4877.  
  4878. See Also:      ENDWHILE
  4879.                REPEAT
  4880.                UNTIL
  4881.                              ────  ──── For Example...
  4882.  
  4883. This macro creates a secondary merge file through a series of
  4884. prompts.
  4885.  
  4886. ASSIGN(More;"Y")
  4887. WHILE(TOUPPER(More)="Y")
  4888.    FOREACH(field;{"First Name";"Last 
  4889.       Name";"Company";"Address";"City";"State";"Zip"})
  4890.       GETSTRING(info;"Enter the "+field;"Field "+field;)
  4891.       TYPE(info)
  4892.       EndField
  4893.       info:=""
  4894.    ENDFOR
  4895.    MergeCode(EndRecord!)
  4896.    CHAR(More;"Enter another record? Y/N")
  4897.    ASSIGN(More;NTOC(More))
  4898. ENDWHILE
  4899. XOR
  4900.  
  4901. Show Me An Example...
  4902. ─────────────────────────────────────────────────────────────────
  4903. XOR is an operator that evaluates at least two expressions in a
  4904. conditional statement.  Conditional statements are created with
  4905. commands such as IF, REPEAT, and WHILE.  This operator performs a
  4906. logical exclusive OR and evaluates a conditional statement as
  4907. true if one expression is true, but not if more than one
  4908. expression is true.
  4909.  
  4910. Parameters:    None
  4911.  
  4912. See Also:      AND
  4913.                IF
  4914.                NOT
  4915.                OR
  4916.                REPEAT
  4917.                WHILE
  4918.                              ────  ──── For Example...
  4919.  
  4920. This macro sends an appropriate letter to one or both employees.
  4921.  
  4922. CHAR(Emp1;"Did employee number one finish the assigned task? 
  4923. Y/N")
  4924. CHAR(Emp2;"Did employee number two finish the assigned task? 
  4925. Y/N")
  4926. IF((TOUPPER(Emp1)="Y") XOR (TOUPPER(Emp2)="Y"))
  4927.    SWITCH ("Y")
  4928.       CASEOF TOUPPER(Emp1) : CALL(Emp1)
  4929.       CASEOF TOUPPER(Emp2) : CALL(Emp2)
  4930.    ENDSWITCH
  4931. ELSE
  4932.    IF(TOUPPER(Emp1)="Y")
  4933.       emp:="Both"
  4934.       Letter:="Congrats"
  4935.    ELSE
  4936.       emp:="Neither"
  4937.       Letter:="ChewOut"
  4938.    ENDIF
  4939. ENDIF
  4940.  
  4941. PERSIST(emp)
  4942. CHAIN(Letter)
  4943.  
  4944.  
  4945. LABEL(Emp1)
  4946.    emp:="Paul"
  4947.    Letter:="ChewOut"
  4948.    RETURN
  4949.  
  4950. LABEL(Emp2)
  4951.    emp:="George"
  4952.    Letter:="ChewOut"
  4953.    RETURN