            ------------------------------------------------

                               PlutCheck

                     Inbound Mail Checking Utility

                              Version 0.50

                             (c) 18-Mar-95

                       by Peter Deane (3:622/401)

                           in GFA-BASIC v3.51

            ------------------------------------------------

Intro:
======

PlutCheck is a small utility to take a look at an inbound directory and
determine if there's any mail in the directory.  It can selectively look
for mail packets, mail bundles and .tic files (any combination or all),
in any directory, and run an optional command if it does find any such
files.

I use it to set an environment variable which is later checked by a
script to see what type of mail processing is needed, however, it could
conceivably actually run a mail processing command if you like.


History:
========

I suggested this sort of program would be useful to Peter Nicolas some
time ago, and was a good exercise in programming.  Pete came up with a
program, however it really didn't fit my needs, and needed some command
line parsing, etc added.  So I sat down to add a few features to what
Pete provided, and ended up almost re-writing the thing from scratch.
There's virtually none of the original code left now, Pete!


Usage:
======

Type "PlutCheck ?" to get a brief template summary, however more
information than that will be required.  Let's have a look at the
template anyway:

PlutCheck [PACKET|BUNDLE|TICK|ALL] [DIR <inbound>] [COMMAND <cmd>]

The command line is not case sensitive, and should not included any
inverted commas (IE ""s or quote characters).

Firstly, the COMMAND statement needs to be the VERY LAST THING given on
the command line, because the rest of the text in the command line from
"COMMAND" onwards is taken verbatim as the command to run.  DO NOT use
inverted commas (""s) anywhere in the command line, PlutCheck's parsing
doesn't get that far down, and this is why the COMMAND needs to be
specified last.

You can specify what sort of mail you want PlutCheck to look for.

"PACKET" (or "PKT" in fact) will tell the program to look for mail
packets.  These are filenames of the form xxxxxxxx.PKT, where there are
8 characters, a dot and the string PKT.

"BUNDLE" will tell the program to check for mail bundles.  Extended mail
bundle names are supported, so specifying this will notice filenames of
the forms xxxxxxxx.MOx, xxxxxxxx.TUx, xxxxxxxx.WEx, xxxxxxxx.THx,
xxxxxxxx.FRx, xxxxxxxx.SAx or xxxxxxxx.SUx.  IE 8 characters, a dot,
MO|TU|WE|TH|FR|SA|SU and one character.

"TICK" will get the program searching for Tick files. IE xxxxxxxx.TIC.

"ALL" will tell the program to search for all three types of mail,
however you can still specify each one individually if you like. (IE
"PlutCheck PACKET BUNDLE TICK" is equivalent to "PlutCheck ALL").

"DIR <inbound>" allows you to specify which directory you'd like
PlutCheck to have a look in.  If not given on the command line, then
MAIL:Inbound will be searched.  Due to the command line parsing, it's
not possible to get PlutCheck to look in a directory which has a space
in its filename.  I doubt that'll be a problem.

"COMMAND <cmd>" allows you to tell PlutCheck exactly what to do if it
happens to find mail (rather than just printing up that it found mail to
the screen)!  It might be some mail processing command, or perhaps the
setting of an environment variable, creation of a directory, or
whatever.  Any single cli command will work (eg execting a script).
The rest of the text in the command line following the characters
"COMMAND" will be taken verbatim as the command PlutCheck runs if it
does find any specified mail.


(Real World) Examples:
======================

Some key lines from one of my mail processing scripts are as follows:

 --cut--

PlutCheck BUNDLE PACKET COMMAND Setenv MailHere TRUE

GetEnv MsgWritten
GetEnv MailHere

IF $MsgWritten EQ TRUE
  IF $MailHere EQ TRUE
    TrapToss Toss Scan
    SetEnv MsgWritten FALSE
    SetEnv MailHere FALSE
  ELSE
    TrapToss Scan
    SetEnv MsgWritten FALSE
  ENDIF
ELSE
  IF $MailHere EQ TRUE
    TrapToss Toss Routing
    SetEnv MailHere FALSE
  ENDIF
ENDIF

 --cut--

It should be noted that if a message has been written my mail editor
sets the environment variable MsgWritten to TRUE.  PlutCheck also sets
the MailHere environment variable to TRUE if there's mail in the
inbound, and so with those two pieces of information, we know whether we
have to toss mail in, scan mail out, or both.  And the script doesn't do
any unnecessary mail processing work.


PlutCheck TICK DIR Mail:Incoming COMMAND Ftick

The above example looks for TIC files, and if found, processes them.


PlutCheck ALL COMMAND Execute Scripts:MailProc

This would check for any sort of mail, and if found execute the script
Scripts:MailProc

I'm sure that'll be flexible enough for you.  If you can think of other
uses for this program, let me know!


Distribution and Politics:
==========================

PlutCheck must NEVER be distributed without all the original files being
present in the distribution copy.  No charge over and above a small
copying fee may ever be levied on the distribution of the program.

All copyrights are retained by the author.  If you use any part of the
source in other programs, acknowledgement must be given.

The liability of the author for any damages caused by this program is
limited to the amount the user has paid directly to the author for the
right to use the software (ie nil).  Claims for amounts greater than
this will be refused.

The author can be contacted:

Peter Deane

FidoNet:   3:622/401        Postal: PO Box 228
GlobalNet: 54:6101/401              Swansea  NSW  2281
AmigaNet:  41:220/401               AUSTRALIA

BBS:    from O/S   +61-49-72-1647
(24hrs) from Aust  (049) 72-1647

For 1995, you can use my email address c8345041@cc.newcastle.edu.au if
you like.  However, I get Fido mail a lot more quickly and will answer
it more quickly too.

            ------------------------------------------------
