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.
|