>Can Samba be used to give a PC direct access to a printer which is on
>the Amiga? If not, there's no point in my installing it. I find FTP file
>transfer using Windows Commander is quick and efficient for moving files
>between Amiga and PC.

>(It's a shareware 2-column program similar to DOpus 4).

>Regards
>--
>Don Cox
>[EMAIL PROTECTED]

Don,

   I've got my A4000 serving as both internet access gateway and Print server
for my PC and my wife's PC.  I originally tried to host the printer on the
PC, but it consistently corrupted the printouts from other machines -- driver
updates, etc. to no avail.  Epson only says that it isn't a "supported
configuration".  Anyway, it works fine with my Amiga as the host.  Here's how
you set it up.

� Setup a "printer" under Samba.  Edit the samba:lib/samba.conf file to
  include something like this:

    [EpsonPro]
      comment     = EpsonStylusPro
      path        = /spare/t/epson
      browseable  = yes
      printable   = yes
      public      = yes
      writable    = no
      create mode = 0700

    Note:  "EpsonPro" is how this appears on the network to the other
           computers.

    Note the "unix" style path:  /spare/t/epson instead of spare:t/epson
    (This should be a temporary directory with _nothing_ in it.)

� Install your printer driver as usual on your PC, just select a network
  printer instead of a local printer.  Use the "browse" button to find the
  printer.

Now, all this is fine and dandy, but at this point all it does is send the
printer data to a file on the Amiga.  We still need to send the data from
this file on to the printer.  AFAIK, there is a way to configure Samba to do
this -- but I never figured it out, so I found an AREXX script on Aminet
(that was designed to print the other way, from the Amiga to a Network
printer) and modified it to print files received from the network to a local
printer.  Here's the script (it's short)  I start it from my s:NetStart
script that Miami launches after it puts the network online.  Here's the line
from the script:

run <>nil: rx Samba:sps.rexx

This isn't a pretty solution, but it works.

Cut the below script out and copy it to a file called "Samba:sps.rexx"  You
could likely get rid of a lot of extra stuff in the script, so it doesn't
require the extra libraries, but I never bothered.  Make sure to edit the
script for your "spooldir" and "printer" settings if needed.

Good Luck.

       --Rhett

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

/* $VER: SPS v1.0 (23/08/99)
   Samba Print Spooler v1.0 by Robert Wilson
   http://www.dynamix.f9.co.uk
   Modified to print FROM PC to Amiga, instead of the reverse by R^3
*/

/* START USER SETTINGS */

spooldir = 'Spare:t/epson/'
printer = 'PAR:'
pubscreen = 'Workbench'

/* END USER SETTINGS */

signal on BREAK_C
signal on FAILURE
signal on IOERR

if ~show(l,'rexxsupport.library') then do
   if ~addlib('rexxsupport.library',0,-30,0) then do
      say 'rexxsupport.library not available'
      exit
   end
end

if ~show(l,'rexxtricks.library') then do
   if ~addlib('rexxtricks.library',0,-30,0) then do
      say 'rexxtricks.library not available'
      exit
   end
end

if ~show(l,'rexxreqtools.library') then do
   if ~addlib('rexxreqtools.library',0,-30,0) then do
      say 'rexxreqtools.library not available'
      exit
   end
end

scriptname = 'Samba Print Spooler v1.0 by Robert Wilson'

if right(spooldir,1) ~= '/' & right(spooldir,1) ~= ':' then do
  call rtezrequest('The spooldir must end in ":" or 
"/"','_Sorry!',scriptname,'rtez_flags = ezreqf_centertext rt_reqpos = reqpos_centerscr 
rt_pubscrname = 'pubscreen)
  exit
end

address 'COMMAND'

do forever
  if getdir(spooldir,'~(#?.info)','stemvar','FILES','PATH') then do
    do i = 1 to stemvar.0
      call sendfile(stemvar.i)
    end
  end
  else call delay (500)
end

exit

/* */

sendfile:
parse arg filename
if open(file,filename,'R') then do /* check to see if file is not still being spooled 
*/
  call close(file)
  'copy 'filename' 'printer
  if RC = 0 then 'c:delete' filename 'FORCE QUIET'
  else call servererror()
end
else call delay(500)
return

/* */

BREAK_C:
call rtezrequest('User break (CTRL-C)','_Okay',scriptname,'rtez_flags = 
ezreqf_centertext rt_reqpos = reqpos_centerscr rt_pubscrname = 'pubscreen)
exit

/* */

FAILURE:
IOERR:
call rtezrequest('An error has occured!' || '0A'x || 
errortext(RC),'_Damn!',scriptname,'rtez_flags = ezreqf_centertext rt_reqpos = 
reqpos_centerscr rt_pubscrname = 'pubscreen)
exit

/* */

servererror:
errorreq = 0
if exists('rexx:autoclose.rexx') then errorreq = autoclose(start,10,pubscreen,'Samba')
answer = rtezrequest('Unable to spool file "'filename'"' || '0A'x || 'to print server 
"'printer'"','_Retry|_Wait 60 seconds|_Quit',scriptname,'rtez_flags = 
ezreqf_centertext rt_reqpos = reqpos_centerscr rt_pubscrname = 'pubscreen)
if errorreq ~= 0 then call autoclose(stop,errorreq)
if answer = 0 then do
  if rtezrequest('Are you sure that you want'|| '0A'x ||'to close Samba Print 
Spooler?','_Yes|_No',scriptname,'rtez_flags = ezreqf_centertext rt_reqpos = 
reqpos_centerscr rt_pubscrname = 'pubscreen) then exit
end
if answer = 2 then call delay(60*50)
return

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

-----------------------------------------------------------------------------
                            Rhett R. Rodewald
               Have you written your own real-time OS lately???

"Most people would rather die than think,
 and most people do." -- Bertrand Russell

-- 

To unsubscribe send "unsubscribe miami-talk-ml" to
"[EMAIL PROTECTED]". For help on list commands send "help" to
"[EMAIL PROTECTED]".


Reply via email to