[net.micro.amiga] Simple Print Spooler for the Amiga

andy@amiga.UUCP (Andy Finkel) (02/20/86)

< o For the Lime Eater  o >

I've thought a print spooler would be easy on a multi-tasking machine like
the Amiga, so this morning I gave it a try.  The following 4 entries
are Amiga execute scripts. Get them onto the Amiga, and put them in
the s directory of your boot disk.

How to use:
Install the 4 parts in the s directory of your Amiga workbench (or CLI)
disk.  
execute startspool once after booting up by typing:

run execute startspool

To spool a file for printing, type

execute print filename

---------------------
This spooler can also be used to give other programs (editors, etc) spool
capability...to use this takes a bit more work on the user's part,
unless your editor has shell escape capability.  Basically, the spooler
attemps to print 3 files in the ram:spool directory (file1, file2, file3)
To print a file via spool, save an ascii copy to one of those files from
your editor.  The extra work involved ?  You have to be sure and not
clobber a file you've previously sent while it is printing.
-------------------------
files:

startspool:  this file should be executed once after you boot your machine.
It makes the necessary directories on the ram: disk, and generally sets things
up.

spooler:  this file contains the guts of the spooler.  The current version
allows up to 3 files to be spooled at once, as long as they all fit into
the ram: disk.  It is a trivial exercise to raise that number, though.
The program checks the spool directory every 30 seconds for files.  You
can raise or lower that number if you want.

spooler1: a script used to restart the spooler.

print: a script used to send files to the spooler from the CLI.
------
Before I list the files, I'd like to point out 2 useful tricks on the Amiga:

1) The alias command (well, sort of...)  :  Scripts like this depend on
the commands still having their original names.  I agree that some are
too long to type every time, so most people have renamed their execute
command, for example to x or ex.  Well, by using the Assign command
you can alias your commands... ie

assign ex: c/execute

To use this alias, just type

ex: scriptname

2) The other 'trick' is that the s directory is for script files, and
the execute command knows enough to look there for script files.

ok, the files of the print spooler:
-------------------------------------------
:s/startspool
-------------------------------------------
; Simple Print Spooler
; Program by Andy Finkel
; Copyright (c) 1986 Andy Finkel, Commodore/Amiga
; This is contributed free software.
; Permission to copy and use as long as this notice is included."
; Permission NOT given to sell this program
; (I'd feel guilty if someone paid for this, it was too easy to do!)
;
IF NOT EXISTS ram:c
makedir ram:spool
ENDIF
IF NOT EXISTS ram:c
makedir ram:c
ENDIF
IF NOT EXISTS ram:t
makedir ram:t
ENDIF
copy c/copy to ram:c
copy c/delete to ram:c
copy c/echo to ram:c
copy c/execute to ram:c
copy c/wait to ram:c
copy c/if to ram:c
copy c/endif to ram:c
copy s/spooler to ram:c
copy s/spooler1 to ram:c
cd ram:c
execute ram:c/spooler
; end of file

---------------------
:s/spooler
---------------------
; Simple Print Spooler
; Program by Andy Finkel
; Copyright (c) 1986 Andy Finkel, Commodore/Amiga
; This is contributed free software.
; Permission to copy and use as long as this notice is included."
; Permission NOT given to sell this program
; (I'd feel guilty if someone paid for this, it was too easy to do!)
;
IF EXISTS ram:spool/file1
copy > NIL: ram:spool/file1 to prt:
echo > prt: "  "
delete ram:spool/file1
ENDIF
;
IF EXISTS ram:spool/file2
copy > NIL: ram:spool/file2 to prt:
echo > prt: "  "
delete ram:spool/file2
ENDIF
;
IF EXISTS ram:spool/file3
copy > NIL: ram:spool3 to prt:
echo > prt: "  "
delete ram:spool/file3
ENDIF
;
wait 30
execute ram:c/spooler1
;end of file

----------------------
:s/spooler1
----------------------
execute ram:c/spooler
;end of file

-----------------------
:s/print
-----------------------
.k file/a
; Simple Print Spooler
; Program by Andy Finkel
; Copyright (c) 1986 Andy Finkel, Commodore/Amiga
; This is contributed free software.
; Permission to copy and use as long as this notice is included."
; Permission NOT given to sell this program
; (I'd feel guilty if someone paid for this, it was too easy to do!)
;
IF NOT EXISTS ram:spool/file1
copy <file> to ram:spool/file1
skip
ENDIF
IF NOT EXISTS ram:spool/file2
copy <file> to ram:spool/file2
skip
ENDIF
IF NOT EXISTS ram:spool/file3
copy <file> to ram:spool/file3
skip
ENDIF
echo "spooler busy, try again later"
LAB
;end of file
----------------------------------


				andy finkel
				Commodore(Amiga)

"No matter where you grow, there you are" - Buckaroo Bonsai

Disclaimer:
"I disclaim all responsibilities, all sizes, all shapes, all colors"