|
5.1 What are
commands
A macro file consists of a series of commands. For example, if
you record a simple text macro, the macro records the action of
inserting text into the document as a Type()
command, with the text that you typed in the parentheses after
the command. (The information in the parentheses is known as a
parameter, which is discussed in
the next section of the tutorial.) If you typed a large amount
of text, it might have been split among several
Type() commands, because the amount of text that
each Type() command can handle is limited. Note
that anything not a character is a separate command:
HardReturn(), Tab()
Indent(), HardPageBreak(), etc.
Remember that simply inserting these codes into the macro file
while you edit only changes the visual formatting of the macro
file; they are not part of the macro program.
There are two types of macro commands: product commands and
PerfectScript programming commands. (PerfectScript is the
programming language for macros in the Corel Office suite of
products.)
5.2 Product
commands
Product commands are commands which are the results of actions
taken in WordPerfect. These commands duplicate the results
obtained when you perform actions manually in WordPerfect. As we
saw above, when you record the action of typing text in a
document, the product command
in the macro is
Type(). When you record the action of changing
line spacing within a document, the product command in the
macro is LineSpacing(). When you move the
cursor to the end of the document, the product command
is PosDocBottom().
5.3 PerfectScript
programming commands
In addition to product commands, macros can contain
programming-language commands for such purposes as
decision-processing, looping, repeating, branching,
error-trapping, pausing the macro, obtaining information from the
user, variables, etc. PerfectScript commands implement the
logic of the macro. For example, to have the macro
pause at at certain point when it is played (to allow the user to
perform some actions, after which the macro resumes) you would
use the Pause() command.
The basic PerfectScript programming commands are covered later
in the tutorial.
5.4 Using the macro
toolbar to insert commands
An easy way to insert product commands while you are editing your
macro is to use the buttons on the macro toolbar.
To insert product commands, click on the small button with the
circle on it. This will start recording your actions. When you
click on the button with the square on it, recording ends, and
the recorded product commands are inserted into the macro you are
editing.
To insert PerfectScript programming commands, click on the
"commands" button on the macro toolbar, and choose the command
you want from the dialog box. Unfortunately, the help accessed
from this dialog box is not context-sensitive. It gives you only
a general description of PerfectScript commands, not help on the
specific command selected.
5.5 The
Application command
When you edit a macro, the first line of the file will usually be
an Application command, in the form
Application (WordPerfect; "WordPerfect"; Default!; "EN")
This command is inserted automatically when you record a
macro, and tells the macro that it will be run within the
WordPerfect program. Generally you need not concern yourself
with this command. If you are writing macros only for
WordPerfect, and not for any of the other programs in the Corel
Office suite, you can omit this command if you write a macro from
scratch.
|
|