![]() |
Advanced Macros - {WHILE} Command Used Incorr |
The information in this document applies to:
WordPerfect® 5.1 for DOS
Problem
Symptoms: The following is the syntax for a macro, which seems to work, but occasionally produces an error condition: {WHILE}({VARIABLE}1~=0)|({VARIABLE}1~>0)|({VARIABLE}1~<0)~ {Backspace} y {ASSIGN}1~{SYSTEM}9~~ {END WHILE} The error prevents a larger nested macro from functioning properly. This {WHILE} loop is intended to loop as long as variable 1 is a number. The logic is if the variable wasn't a number, then the variable was to be false and stop the loop. Solutions: The problem is, if the variable does exist, then an error condition happens. On page 939 of the manual on "{WHILE}expr~," the variable should exist before the {WHILE} is executed. This loop is also incorrect in another way; if the contents of variable 1 is text, then the {WHILE} loop's expression should be surrounded by quotations marks like the following syntax: {WHILE}("{VARIABLE}1~=0")|("{VARIABLE}1~>0")|("{VARIABLE}1~<0")~. This would cause problems because when quotations are used in expressions (as mentioned on page 839) then the WordPerfect character sets are compared instead. Basically the whole logic and design of the macro is incorrect, but it can do the job as long as the variable exists. If the macro checked to see if the variable existed before the beginning of the while loop and before the next iteration, then it worked fine. |
Answer:
Details:
Product specifications, packaging, technical support and information (*Specifications*) refer to theUnited States retail English version only. Specifications for other versions may vary. All Specifications, claims, features, representations, and/or comparisons provided are correct to the best of our knowledge of the date of publication, but are subject to change without notice.OUR MAXIMUM AGGREGATE LIABILITY TO YOU AND THAT OF OUR DEALERS AND SUPPLIERS IS LIMITED. IT SHALL NOTEXCEED THE AMOUNT YOU PAID TO ACCESS THE INFORMATION. SEE LEGAL DISCLAIMER. |