Hi, I'm trying to find a way to send a simple text file (that contains special IBM ProPrint characters) to a Sercomm PrintMate print server via AppleTalk. See a picture of it at: http://www.acmenet.net/~jeffny/AppleTalk/screens.html ......the PrintMate is connected to a Lexmark 2380 dot-matrix printer.
Seems simple enough right? I've tried several programs like LPR (by Casper Boon), PSTool, and DropPS. Each one has a problem. LPR (using TCP/IP) works but only for about 8 pages (the PrintMate only has about a 20k buffer and LPR does no "flow control"...it also crashes a lot). DropPS (using AppleTalk) works but has a problem with the IBM ProPrint characters in the file. (I prefer AppleTalk to TCP/IP...for a couple reasons....described here: http://www.acmenet.net/~jeffny/AppleTalk/print.html .....the PrintMate supports both AppleTalk and TCP/IP connections) [as a temporary solution I'm using LPR after first breaking my text file into smaller files to send to the print, but it still crashes the computer regula rly (ie ALOT) and it's a pain to have to keep switching between PPP and "Built-in Ethernet" in the TCP/IP Control Panel.....LPR also appears to not work with the Asante 10/100 Fast Ethernet adapter, forcing me to keep using the slower built-in ethernet] I decided to try and write my own printer app using FutureBasic. Long story short, it just wasn't practical. So I then turned to RealBasic and SuperSocket 2.0.4 (http://essencesw.com/Plugins/supersocket.html). I was looking at the free Nubz OTPlugin (http://www.nubz.org/). Both SuperSocket and the OTPlugin add support for AppleTalk and more TCP/IP features to RB. But getting help on using them is very difficult. I have no experience in C, but I bought Code Warrior (Mac) Learning Edition. The installer installs over 9000 files on my computer! eeee! Steep learning curve too....and trying to use AppleTalk is extremely complicated. I thought maybe I could recompile the source code of LPR or another app to stop the crashing. I've been trying to learn about networking, I actually have several projects in mind I'd like to do if I just knew how to use OT. Inside Macintosh on Open Transport is not an easy read...and Apple seems to have made using some parts of AppleTalk purposely difficult by lack of information. Then I found Perl. And someone suggested "lpr_in_perl.in". The "Get_printer_name" sub-routine would not work, so in "lpr_in_perl.in" I set the printer name manually: # get the printer name $Printer = "SCF20811"; (I also tried the TCP/IP address (number) of the print server) That stopped the error I was getting, but when I run the program (script?) nothing happens. MacPerl never asks what file I want to send to the printer. >Nothing< happens. Anyone have any suggestions? I am using MacPerl 5.6.1r1 (which for some reason won't Quit...I have to force quit it). Very frustrated, Jeff- Beige G3 / System 8.6 ==================================== eval 'exec @PERL@ -S $0 ${1+"$@"}' if $running_under_some_shell; # this emulates #! processing on NIH machines. # (remove #! line above if indigestible) use strict; use English; use Socket; use LPRng; use Getopt::Std; use Sys::Hostname; my($Printer, $Pc_value, $Debug ); my($pr, $remote, $port, @files, $file, $f, $hostname, $username); my($cf, $df, $idn, $cfn, @dfn, $fn, $filecount, $i, $v, $SOCK, $sendcf,%Args); my($options) = "Z:O:"; $| = 1; $Debug = 0; Set_Debug($Debug); getopts( $options . "P:", \%Args ); Setup_LPRng( %Args ); # get the printer name $Printer = "9.9.9.9"; if( not $Printer ){ die "missing printer name"; } print "Printer '$Printer'\n" if $Debug; $Pc_value = Setup_pc_entry( $Printer ); ($pr, $remote, $port ) = Get_remote_pr_host( $Printer, $Pc_value ); print "pr '$pr', remote '$remote', port '$port'\n" if $Debug; if( !(@files = @ARGV) ){ $f = "/tmp/lpr$$"; @files = $f; open TEMP, ">$f" or die "cannot open $f - $!\n"; while( defined( $i = <> ) ){ print TEMP $i or die "cannot write $f - $!\n"; } close TEMP or die "cannot close $f - $!\n"; } print "files " . join(",",@files) . "\n" if $Debug; $hostname = hostname(); $username = getpwuid($UID); $cf = "H$hostname\n" . "P$pr\n" . "L$username\n" ; foreach $i ( split //, $options ){ print "option $i\n" if $Debug; $v = $Args{$i}; if( $i ne ":" and $v ){ print "option $i='$v'\n" if $Debug; $cf .= "$i$v\n"; } } $idn = $$ % 100; $cfn = sprintf( "cfA%03d%s", $idn, $hostname ); print "cfn='$cfn'\n" if $Debug; $fn = "A"; $filecount = 0; for( $i = 0; $i < @files; ++$i ){ $file = $files[$i]; if( ! -f $file || ! -r _ || ! -s _ ){ print "not a readable, nonzero length file - $file\n"; } else { $df = sprintf( "df%s%03d%s", $fn, $idn, $hostname ); $dfn[$i] = $df; $cf .= "N$file\n" . "f$df\n" . "U$df\n"; ++$filecount; ++$fn; if( $filecount == 26 ){ $fn = "a"; } } } if( $filecount > 52 ){ print STDERR "too many files\n"; exit 2; } if( $filecount == 0 ){ print "nothing to print\n"; exit( 1 ); } if( $Debug ){ print "cf contents = '$cf'\n"; print "cf len " . length( $cf ) . "\n"; } $SOCK = getconnection( $remote, $port ); sendit( $SOCK, sprintf( "\002%s\n", $pr ));; $sendcf = "\002" . length( $cf ) . " $cfn\n"; sendbuffer( $SOCK, $sendcf, $cf ); print "sending files '@files'\n" if $Debug; for( $i = 0; $i < @files; ++$i ){ if( $dfn[$i] ){ sendfile( $SOCK, $dfn[$i], $files[$i] ); } } close ($SOCK) or die "close: $!"; exit 0;