home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Gold Fish 1
/
GoldFishApril1994_CD2.img
/
d5xx
/
d516
/
xl
/
macro.doc
< prev
next >
Wrap
Text File
|
1991-07-20
|
6KB
|
162 lines
xl Macro Information
by Martin Kees
The true power of xl is only evident when the user can
take advantage of the macro capability of xl. From
xl the user can quickly define and execute macros that
can aid in producing the output required for a particular
application. It is strongly urged that the user learn
and be familiar with this capability.
xl uses ARexx(tm) by William S. Hawes as it's macro
language interface. ARexx is a full featured interpreted
language system that is ideal for interactive work.
In xl it easy to write short ARexx macros without
having to use an editor. These macro programs can then be
attached to a function key for easy execution. For more
involved macros, they can be composed in a text editor
and envoked by name or function key.
The xl.doc file lists all the commands and their formats available
for macro programming. Each command may require arguments and
may return results to the macro program. For the arguments to
be passed correctly there are certain standards the user should
use in writing macros.
NUMERIC Arguments
xl expects integer arguments. That is if an argument is
numeric xl does not want to see a decimal point in the string
sent from the macro. This can happen if the user uses division
in the argument instead of integer division ( % is the integer
division operator in ARexx). Examples:
blit xposition+3 yposition/2 * possible ERROR
blit xposition+3 yposition%2 * CORRECT
The argument list in all xl commands uses white space as
argument separators. If you want to use a negative number
as an argument you should ensure that it is passed correctly.
For example:
polyscale 100 -100
will be sent as POLYSCALE 0. ARexx interprets the minus sign as
subtraction. Use one of these forms instead:
polyscale 100 (-100)
or
yscale= -100;polyscale 100 yscale
or
polyscale 100 '-100'
STRING Arguments
Care must be taken in sending strings to xl to preseve the
case of the string and when the string contains blanks. ARexx
interprets the command statement before sending it to xl. If
a string is unquoted it will be converted to uppercase. This
may not be what the user intends. Examples:
text 30 45 hello
is a valid command but will produce HELLO at the x,y position.
text 30 45 'hello'
preserves the lowercase string.
text 30+t 100-xx 'hello world'
will produce an error message. ARexx strips the single quotes
before sending to xl. xl will receive TWO strings ( hello and
world) instead of the one intended. The user must force ARexx
to send the string with quotes:
text 30+tt 100-xx '"hello world"'
or
text 30+tt 100-xx '"' || hello world || '"'
or
text 30+tt 100-xx '22'x || hello world || '22'x
or
qt= '22'x;text 30+tt 100-xx qt || hello world || qt
RESULTS from xl commands
Many xl commands return results to the macro program. For the macro
program to use the result the ARexx statement:
options results
must be encountered in the macro program before the command.
To use the result returned it should be parsed and/or saved
in a variable. Examples:
options results
getxy
xy= result
blit xy
options results
getxy
parse var result xval yval .
text xval yval 'Message'
Note that in the first example the variable xy contains two
numeric arguments, whereas in the second the two values
have been parsed into different variables.
SCRIPT macros
Script macros do not use the ARexx interface. This does limit
their use since there are no control structures or variables
available in scripts. Their main advantage is speed.
Since script commands are not interpreted their arguments must
be in 'processed' form. Ther is no evaluation of expressions and
strings must be in final quoted format. Examples:
text 30 45 hello
TEXT 30 45 hello
text 30 45 "hello there"
autoaspect ON
are correct script commands, whereas:
text 30+3 45 hello
text 30 45 hello there
autoaspect on
will produce errors. The first since no expression
evaluation is done. The second since the string isn't quoted.
The last since the on string should be in uppercase.
These same considerations should be used when sending
individual script commands with the @Command option.
FUNCTION KEY MACRO files
xl can save and load files that control function key macro
envocations. The files are ASCII text files that may be
edited in a text editor. Each file consists of 30 lines.
Each line contains a two character 'type' code and then the
text of the macro if defined. The type codes are:
** No macro installed
AR ARexx macros
A' 'ARexx' macros
SC Script and @Command macros
Note that line 10 of the file should be ** since the F-10
key is reserved for toolbox toggle. The text of the macro
cannot contain a newline and must be on a single text line.