Sorry if I was not clear :)

I have been approached by one of my customers to make an application
(script) that will take input from a file and print labels for them so
they do not have to enter them into the label printing program already
made, one by one. It gets tedious for them to do this for 100 lots for
instance.

What I need to do then is get LOT1 into the variable $lot and PRODUCT1
into the variable $prod. So while I have the loop going. I will then
take these variables and put them into another string of code I have to
output to a printer so they will print labels in a certain format with
the lotnumber and productname on them.

The format I will put this into to send to the printer is as follows:

printCode = printCode & "^XA^LH30,30" & _ "^FO110,65^A0,N,100^FD" & _ lotNumber & "^FS" & _ "^FO150,160^BY2,3.0^B3N,N,125,N,N^FD" & _ lotNumber & "^FS" & _ "^FO75,375^A0,N,50,30^FD" & _ productName & "^FS" & _ "^FO30,425^BY2,2.0^B3N,N,50,N,N^FD" & _ productName & "^FS" & _ "^XZ" & vbNewLine

I took this from teh main printing program that prints labels one at a
time. I believe this was either written in VB or C something. I will
have to substitute lotNumber for $lot and productName for $prod. Then
find teh correct syntax to send this to the printer and I have what I
need.

I have been working on thsi still while waiting on a reply. Do you think
this does it? (Gotta love it when you find the right words you were
looking for to search on google) LOL

#!c:\perl\bin my $printCode = ""; my $lotNumber; my $productName; my $Info; open (LABELS, "labellist.txt") or die "I could not get at labellist.tx +t as input"; while (<LABELS>) { chomp; if (m%E%) { # print "$_\n"; # print "\n"; $Info=$_; $lotNumber=substr($Info, 0,8); $productName=substr($Info, 9); # print "$lotNumber\n"; # print "$productName\n"; $printCode = "$printCode & \"\^XA\^LH30,30\" & _ \"\^FO110,65\ +^A0,N,100\^FD\" & _ $lotNumber & \"\^FS\" & _ \"\^FO150,160\^BY2,3.0\ +^B3N,N,125,N,N\^FD\" & _ $lotNumber & \"\^FS\" & _ \"\^FO75,375\^A0,N +,50,30\^FD\" & _ $productName & \"\^FS\" & _ \"\^FO30,425\^BY2,2.0\^B +3N,N,50,N,N\^FD\" & _ $productName & \"\^FS\" & _ \"\^XZ\" & vbNewLin +e"; print $printCode; } }

Now I am not sure that the syntax to the $printCode is correct, but I
will get that down to a T sooner or later.

In reply to Re^2: Parse data from a line to get 2 variables by Sunnmann
in thread Parse data from a line to get 2 variables by Sunnmann

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.