This archive contains a few example ARexx programs. A few of them might
even be useful to you.
----------------------------------------------------------------------------
Notes: These programs assume that the ARexx support library has been
       opened. I open it in my startup-sequence because I use ARexx a lot.

       On my system, 'delete' is called 'del'. If it isn't called that on
       your system, just change any occurences of 'del' to whatever you
       call it on your system.

       Many of these programs are tools I use often. Since I don't like
       typing 'rx' before them, I use WShell. I highly recommend it.
----------------------------------------------------------------------------
The programs:

join.rexx
----------
  The standard Amigados JOIN command has a small problem. If the output
file is the same name as one of the input files, JOIN will complain, and
will even wipe out that file, leaving it empty. join.rexx fixes this  by
detecting whether the above condition is met, and if it is, changes the
command line to make the output a file called 'arexxtempfile', calling the
Amigados JOIN with it, then copying the temp file to the real output file
name, and deleting the temp file.

append.rexx
-----------
Syntax: append a b c

  A special case of JOIN. In the above example, will JOIN files named a, b,
and c. The resulting joined file will be named 'a'. It does its work by
adding 'AS' and the first filename in the command line to the end of the
command line and calling join.rexx

copy.rexx
---------
  This was written to do a job for me. It also serves as an example of how
to modify a command by placing an appropriately named file in the REXX:
directory. If you are using WShell, the REXX: directory is searched before
the C: directory when you type a command. If the file is found, it will be
executed as an ARexx script, allowing you to do anything you want with the
command line before calling the actual program. In this case, copy.rexx
lets me use the '*' wildcard. it performs its function by replacing all
instances of '*' with '#?'.

man.rexx
--------
  Similar to the Unix 'man', this allows you to have online documentation
files. In my case, I have an assigned directory called 'DOCS:', and within
that directory, a number of text files that end with '.doc'. This program
finds the appropriate one and uses 'more' to display it. You could have it
call your favourite editor, or just type the file out to the console.

plot.rexx
---------
  This one is by Rick Morris of Vancouver BC. It is rather specialized, but
fascinating because it shows the power of ARexx in non-trivial programs.
It will accept a PCLO 'BLOCK' file, and plot it double sized on a Toshiba
P351 printer (24 pin, impact, dot matrix). You can probably modify it for
any other printer, though best results will be obtained with 24 pins or
on a laser printer. PCLO is a printed circuit board CAD program from
SoftCircuits.

touch.rexx
----------
  Sets the date on a file to the current date and time. Setdate is normally
used for this, and in fact is called by touch.rexx to do its thing. The
difference here is that if the file does not exist, it will be created as
an empty file. Handy for those programs that require a file of a certain
name, but aren't smart enough to create one.

arcall.rexx
-----------
  A program that will ARC all files within a directory, including
subdirectories.  It will rename all files to the form 'File1', 'File2',
etc.  and will generate a standard Amigados script file that will be
included in the .ARC file.  This script file, when executed, recreates the
original file structure, creating any necessary subdirectories and renaming
all files back to their original names. Written at the request of the sysop
of the Panorama BBS in Vancouver BC.

ports.rexx
ports2.rexx
-----------
  Two examples (not at all useful) of interprocess communication. To use,
open a second CLI, and run 'ports' in one of them. It will print a message
and wait. When you run 'ports2' in the other CLI, it will send a message to
'ports'. When 'ports' receives the message, it will print it and exit.
---------------------------------------------------------------------------

Use the code in these programs in any way you see fit. If you have examples
of your own ARexx programs, I and many others would like to see them.

Larry Phillips.
    Compuserve: 76703,4322

============================================================================
============================================================================


sizeblk.rexx
------------

From: daveh@cbmvax.UUCP (Dave Haynie)
Subject: Re: ARexx Questions
Date: 29 Jun 88 00:02:16 GMT
Organization: Commodore Technology, West Chester, PA


In article <2119@cadovax.UUCP>, kaz@cadovax.UUCP (Kerry Zimmerman) says:
> After reading so many glowing words about ARexx here on the net ...
>
> Why would I want to write a script in ARexx, instead of using a CLI script
> or a Shell script (using Matt's Shell)?

I don't recall the examples on the ARexx disk offhand.  But there are lots
of things you can't do easily, or possibly at all, using the CLI script
language, or probably Matt's shell language (tough I haven't used it
myself).  One of the features I like the most about the ARexx language
is that it supports recursive subroutines, like any REAL computer language.

Consider, for a moment, this problem.  I've got gobs of stuff on my
hard disk, all kinds of directories filled with Usenet downloads.  I
like to transfer whole directories over to floppy disks.  I waste lots
of time if I try to transfer a directory and find out that it won't
fit on the space remaining on a floppy.  So I want a function that'll
tell me the size, in blocks, of a directory tree.

Here's an ARexx solution, written in about 10 minutes.


> No advantage is gained using ARexx over the CLI or Shell to communicate
> with DOS that I know of.

I'd be interested in seeing this done with CLI Scripts.  You could certainly
write a C program to do this, but it would be longer, and it would probably
take more than 10 minutes to write.  I guess it would be faster, too, but
this is just an example.


> Kerry Zimmerman
> #  {ucbvax,decvax}!trwrb!cadovax!kaz  Contel Business Systems 213-323-8170
> A difference between an amateur and a professional, is that a professional
> has the right tools.

--
Dave Haynie  "The 32 Bit Guy"     Commodore-Amiga  "The Crew That Never Rests"
   {ihnp4|uunet|rutgers}!cbmvax!daveh      PLINK: D-DAVE H     BIX: hazy
                "I can't relax, 'cause I'm a Boinger!"

============================================================================

bugs for sizeblk.rexx
---------------------

I had to add a call to addlib() up at the top to open the rexxsupport.library,
which is where showdir() lives.  Also changed to format of the output results.

Doesn't handle multiple directories from the command line.

No check to insure input arg is really a dir ... just gives 0 blocks if it's
a single file.

Doesn't (cleanly) handle a non-existent dir as input arg ... relys on ARexx
error message.

If no directory name given on the command line, gives the block count of the
current dir, but does NOT print it's name in the output.

