Hal,

>>> Could someone steer me to a program like this that can be run in text
>>> mode, making simple text labels, no icons, sending to an Epson
>>> compatible printer?

>>      Consider perl (Portable Extraction and Report Language).

> I should really hunker down and learn how to do this in perl,
> but the learning curve gets steeper every month... :^)...

        I recommend

        Learning Perl, 2nd Edition
        By Randal L. Schwartz & Tom Christiansen Foreword by Larry Wall
        2nd Edition July 1997
        1-56592-284-0, Order Number: 2840
        302 pages, $29.95
        http://www.ora.com/catalog/lperl2/

        The following is a modification of a program I use to interpret
Netscape's cookie file.  I believe that you could use it as follows to
make 5 copies of each label.

        > makelabels -?         # Report usage
        > makelabels -i labels.dat -r 5 | lpr

                ---- makelabels ----
#!/usr/bin/perl
# Project: Make Printer Labels
# File:    Perl Script
# Author:  Dr. Robert J. Meier
# History: 99-10-12 -rjm- file creation



#
# Constants
#



#
# Requires
#
require "getopts.pl";           # &Getopts



#
# Subroutines
#



#
# Entry
#

# Default command line arguments
$opt_a = 40;                    # Number of characters across each label
$opt_d = 6;                     # Number of lines down each label
$opt_w = 2;                     # Number of data labels across each page
$opt_h = 10;                    # Number of data labels down each page
$opt_x = 1;                     # Left margin in characters
$opt_y = 1;                     # Top margin in lines
$opt_r = 1;                     # Repetition count of each label
$opt_l = 4;                     # Count of lines in label data
$opt_i = "-";                   # Source file of label data
$opt_o = "-";                   # Destination file for printer sheets

# Process command line arguments
$error = !&Getopts("w:h:x:y:r:l:i:o:");

# Report usage if necessary
unless (0 == $error) {
  print STDERR "usage: $ARGV[0] [-w width] [-h height] [-x leftmargin] [-y 
topmargin]\n";
  print STDERR "    [-a across] [-d down]\n";
  print STDERR "    [-r repetition] [-l lines] [-i data] [-o out]\n";
  print STDERR "  -a characters per label       [$opt_a]\n";
  print STDERR "  -d lines per label            [$opt_d]\n";
  print STDERR "  -h label count down page      [$opt_h]\n";
  print STDERR "  -i data filename              [$opt_i]\n";
  print STDERR "  -l lines of data per label    [$opt_l]\n";
  print STDERR "  -o printer filename           [$opt_o]\n";
  print STDERR "  -r repetition count per label [$opt_r]\n";
  print STDERR "  -w label count across page    [$opt_w]\n";
  print STDERR "  -x left margin in characters  [$opt_x]\n";
  print STDERR "  -y top margin in lines        [$opt_y]\n";
}

# Generate the repetition of labels
else {
  open (IN, "$opt_i") || die "Unable to open data file, $opt_i: $!";
  open (OUT, ">$opt_o") || die "Unable to open printer file, $opt_o: $!";

  # Start first page
  local($remain) = 0;           # Repetition count remaining of current data;
  local($x, $y) = (0, 0);       # Position on print page
  local($oline, @row) = (0, ()); # Row line and buffer
  local($iline, @data) = (0, ()); # Data line and buffer

  # Read and replicate label data
  while (!(eof IN) || (0 < $remain)) {

    # Print top and left margins
    print "\n"x$opt_y if 0 == $x;
    for ($oline = 0; $opt_l > $oline; $oline++) {
      $row[$oline] = " "x$opt_x;
    }

    # Generate a print page row
    for ($y = 0; $opt_w > $y; $y++) {

      # Collect each data set
      if (0 == $remain) {
        for ($iline = 0; $opt_l > $iline; $iline++) {
          local($line) = scalar(<IN>);
          chop $line;
          $data[$iline] = $line;
        }
        $remain = $opt_r;
      }

      # Append data to the current row
      for ($oline = 0; $opt_l > $oline; $oline++) {
        $row[$oline] .= $data[$oline];
        unless ($opt_w == (1 + $y)) {
          $row[$oline] .= " "x($opt_a - length($data[$oline]));
        }
      }
      $remain--;
    }

    # Print a row
    for ($oline = 0; $opt_l > $oline; $oline++) {
      print OUT $row[$oline]."\n";
    }
    print OUT "\n"x($opt_d - $opt_l);

    # End a page if necessary
    unless ($opt_h > ++$x) {
      print OUT "\f\n";
      $x = 0;
    }
  }

  # Cleanup
  print OUT "\f" unless 0 == $x;
  close OUT;
  close IN;
}
                ---- makelabels ----

                ---- labels.dat ----
First Line First Data
2nd Line
3rd Line
4th Line
First Line Second Data
2nd Line
3rd Line
                ---- labels.dat ----

                ---- makelabels -i labels.dat -r 3 -h 2 ----

 First Line First Data                   First Line First Data
 2nd Line                                2nd Line
 3rd Line                                3rd Line
 4th Line                                4th Line


 First Line First Data                   First Line Second Data
 2nd Line                                2nd Line
 3rd Line                                3rd Line
 4th Line                                


<new page>

 First Line Second Data                  First Line Second Data
 2nd Line                                2nd Line
 3rd Line                                3rd Line
                                         


<new page>
                ---- makelabels -i labels.dat -r 3 -h 2 ----

P.S. 
        > Greetings and thanks for your reply. I **deserved** it.

        I meant no disrespect.  I apologize if my concise reply was offensive.

-- 
                                        Dr. Robert J. Meier
                                        tel:+1.248.650.9488
                                        mailto:[EMAIL PROTECTED]

Reply via email to