Original_To:  JNET%"i-amiga@ubvm.bitnet"
Newsgroups: bit.listserv.i-amiga
Date:         Sun, 6 Sep 1992 21:28:00 EDT
From:         BARNETTJ@SNYSYRV1.BITNET
Subject:      Beginners Guide To AREXX

Since I too have been on this list for a long Time without
learning much from arexx, here is my contribution:

1) To startoff any arexx script, the opening line must include a comment
/* Comment in here */

Thus, a basic analogy /* comment */ is the same thing as REM

Basic's Print is roughly equivalent to the AREXX SAY
The format for say is say ' stuff to be printer '   Note the quotes can
be single or double

Basics for next loop which is set up like this
Do I= 1 to 100: Print I: Next I
Equals Arexx's DO loop
Here is the
loop

Do I = 1 to 100 : say I : end

(Incidentally, I realize that my basic example above should have read
For I =1  to 100: Print I: Next I   - Typo!

Math expressions are handled the same way as in basic.

Now some special commands

Address Command "run dh0:prowrite"

What this does is from my arexx script run prowrite.

More to the point, Address command lets you feed commands through to
amigados.  As long as you are in the correct directory, you should
be able to run any program or execute any comand

Address 'ProWrite'

That is something different.  Here I am letting arexx know that if
it comes across any commands it has never seen before, it should check
the wordprocessor ProWrite, which is running concurrently, to see
if its extended arexx (the commands that it adds to arexx to do
specific functions) has the unknown command.

Lastly, arrays.

When I first started playing with arexx and wanted to assign an array
and fill it with data, nobody was able to help me on the list.

In Basic, if you wanted to fill an array you would do something like this:
Dim fish(100)
For I = 1 to 100
input "Enter the data";fish(100)
Next I

Unfortunately, from my own experimentation and search, the closest to
this that arexx allows you is the following
fish.1= ' '; fish.2=' ';fish.3=' ';fish.4=' ';fish.5=' '....and so on
to 100

do I = 1 to 100
Say 'Enter the data'
parse pull answer
fish.i= answer
end

That reminds me!
Parse is roughly equivalent to Input from basic
Pull is just a option for cursor input.


So Lets write a worthless arexx program so you guys can see how to put
the pieces together.  Remember, line numbers are not used.  Also, to
execute a script, from the CLI type RX and the script nam

so rx test.rexx


My test script:

/*this is my rem statement so that I can run this dumb script */
say "This is the first line to this script.  What should I do?"
say "I know...I will have the user select what program he wishes"
say "to run...sort of like the IBM menu programs!  I will use"
say "Prowrite and Amax as examples"
say " "
say "do you wish to run (A)max or (P)rowrite?"
Parse pull answer
if answer <> "A" and answer <> "B" then exit /* end script */
if answer = "A" then address command "run dh0:wordprocessors/Prowrite";exit
if answer = "B" then do
    say "I am going to run amax"
    address command "say -r"I am now going to run amax""
    Address command "run dh0:emulators/amax"
    end

Pretty easy, eh?

Look, lets see if we can get some AREXX teaching going on on this list.
I know that there is an AREXX list, but it is essentially dead.
There are enough people here who feel the way the person requesting
help from us regarding AREXX does...so how about it?

-Jordan
Comments: Gated by NETNEWS@AUVM.AMERICAN.EDU