September
1997 Macro Q&A
Getting Information from the Document Summary
Q. How can I extract information that is saved in the Document Summary with a
macro? For example, I need to determine who the author of the document is, and when the
docuemnt was last revised.
A. In WordPerfect for Windows, you can use the GetData command to extract
information from the Document Summary. For example, to get the author's name, use the
command:
GetData(vAuthor; Summary!; Data!; CurentDoc!; Author!)
The information stored in the Author field of the Document Summary will be
stored in the variable specified in the first parameter. In this case, the variable
is vAuthor. Before using this command you must be certain that a document summary exists.
An error will occur if it does not exist when you use this command.
In WordPerfect for DOS, system variables can be used to extract Document Summary
information. For example, the command
vAuthor := ?DocSummaryAuthor
will return the desired information.
My WordPerfect for Windows Macros books have an entire list of all the possible values
for each parameter of the GetData command, as well as information on which parameters need
to be used with which data group.
My WordPerfect for DOS macros book has a list of all the system variables available in
that version of WordPerfect.
Selecting text between two codes.
Q. I am reformatting my son's doctoral thesis from GML (Generalized Markup
Language), which was used at Princeton Univ. about 10 years ago, and want to get it into
WP 7. Is there a way to select text between two GML formatting codes? For example, :fn.
is the start of a footnote and :efn. is the end. Is there a way to search for
:fn., search for :efn. and select the text in between the two?
A. Yes, you can select between two codes, whether they be WordPerfect codes or
textual codes. Here's an example:
SearchString (StrgToLookFor: ":fn.")
MatchPositionBefore()
SearchNext (SearchMode: Extended!)
SelectMode (State: On!)
SearchString (StrgToLookFor: ":efn.")
MatchExtendSelection ()
SearchNext (SearchMode: Regular!)
At this point, you can cut the selected text, create the footnote, and paste the text
into the footnote. Be sure to use the Close() or SubstructureExit()
command to close the footnote before searching for the next occurence of the codes.
Later in a second pass, you can remove the codes :fn. and :efn.

If you have a question about PerfectScript or WordPerfect for DOS macros, you may submit
it may emailing me.
Include the words PSJournal-Question in the Subject line.
Sorry, I can't publish or acknowledge all submissions. All submissions become the
property of PerfectScript Journal. |