I am trying to print and RFID label and get back the return status that tells
me if the label printed; how many labels remain in the printer, etc.
Below is my code which does not work:
It prints the label but does not put the ECP code in the label. Nor does it
get my return status that I need.
* print rfid labelSET SAFETY OFF
CLOSE ALLSET EXCLUSIVE OFFUSE n:\training\data\teleas01 ALIAS d0lease
lcVin = '3LN6L2JK1ER813539'LOCATE FOR vin = lcVinIF EOF() APPEND BLANK REPLACE
vin WITH lcVinENDIFlcUniq_Num = ALLTRIM(STR(uniq_num))
lcWhatPrinter = ""lcEscape = Chr(27)
Dimension laPrinters[1,1]lnCounter = 1
*** check to see if window sticker printer driver is installed on*** user's
PC*** NOTE: This does not guarantee that the label printer is actually***
attached to the PC...only that the driver is installed.lcPrinter =
""=Aprinters(laPrinters)
For lnCounter = 1 To Alen(laPrinters,1) If
Left(Upper(Alltrim(laPrinters[lnCounter,1])),5) = 'SATO ' lcPrinter =
Alltrim(laPrinters[lnCounter,1]) lcWhatPrinter = lcPrinter Exit EndifEndfor Set
Printer To Name Alltrim(lcWhatPrinter) *** tell printer we are beginning a label
??? lcEscape + "A"
lcEPC = "01000A8900016F00169DC0"*** vin barcode ??? lcEscape + "V100" +
lcEscape + "H250" + lcEscape + "$="+lcVinIf .Not. Empty(vin) ??? lcEscape +
"H50" + lcEscape + "V200" + lcEscape +"B102075" + "*"+lcEPC+"*" Endif*???
lcEscape + "V200" + lcEscape + "H50" + lcEscape + "$=12345"*??? lcEscape +
"V300" + lcEscape + "H150" + lcEscape + "$=12345"??? lcEscape + "Q1"*** tell
printer to go ahead and print??? lcEscape + "Z"
Set Console OnSet Device To ScreenSet Printer To DefaultSet Printer Off WAIT
WINDOW timeout(5)
* now try for the return status
Set Printer To Name Alltrim(lcWhatPrinter)
??? lcEscape + "A"??? lcEscape + "IP1"??? lcEscape + "Z"
Set Console OnSet Device To ScreenSet Printer To DefaultSet Printer
Off*************************************************Below is a sample that is
supposed to work in Delphi:
procedure TPkFrm.WriteToPrinter (psPrinterName, psStr: string; piPrintQty:
integer);
var
Handle: THandle;
N: DWORD;
DocInfo1: TDocInfo1;
lsPrintESC: string;
begin
/ / PrinterName: printer name (for example: EPSON LQ-1600K), S printer ESC
instruction set.
/ / ShowMessage (IntToStr (iPrintBarcode) + '=' + Printer.Printers
[iPrintBarcode] + 'iPrintLabel =' + IntToStr (iPrintLabel));
if not OpenPrinter (PChar (psPrinterName), Handle, nil) then
CreateError ('An error occurred when printing bar code! Can not get a bar code
printer' + the IntToStr (GetLastError), nil, 1);
with DocInfo1 do begin
pDocName: = PChar ('SATO barcode is printed:' + psStr);
pOutputFile: = nil;
pDataType: = 'RAW';
end;
StartDocPrinter (Handle, 1, @ DocInfo1);
StartPagePrinter (Handle);
/ / Print command: start
lsPrintESC: = Chr (27) + 'A';
WritePrinter (Handle, PChar (lsPrintESC), Length (lsPrintESC), N);
/ / Page size
lsPrintESC: = Chr (27) + 'A1' + '1216' + '3776';
WritePrinter (Handle, PChar (lsPrintESC), Length (lsPrintESC), N);
/ / 1, 2, 3
lsPrintESC: = Chr (27) + '# E3';
WritePrinter (Handle, PChar (lsPrintESC), Length (lsPrintESC), N);
/ / Aduject start point
/ / S: = Chr (27) + 'A3V' + edt9.Text + 'H' + edt10.Text;
/ / WritePrinter (Handle, PChar (S), Length (S), N);
/ / Print command: Barcode {BG Code128
/ / S: = Chr (27) + 'V0020' + # 27 + 'H0001' + # 27 + 'BG04260' + '2
ZC100126614134523507 ';
lsPrintESC: = Chr (27) + 'V0040' + Chr (27) + 'H0001' + Chr (27) + 'BG04256'
+ PsStr;
WritePrinter (Handle, PChar (lsPrintESC), Length (lsPrintESC), N);
/ / Print command: bar code characters
lsPrintESC: = Chr (27) + 'V0320' + Chr (27) + 'H0320' + Chr (27) + 'L0101' +
Chr (27) + 'P03' + Chr (27) + 'WB1' + psStr;
WritePrinter (Handle, PChar (lsPrintESC), Length (lsPrintESC), N);
/ / Print command: the number of copies
lsPrintESC: = Chr (27) + 'Q' + IntToStr (piPrintQty);
WritePrinter (Handle, PChar (lsPrintESC), Length (lsPrintESC), N);
/ / Print command: end
lsPrintESC: = Chr (27) + 'Z';
WritePrinter (Handle, PChar (lsPrintESC), Length (lsPrintESC), N);
EndPagePrinter (Handle);
EndDocPrinter (Handle);
ClosePrinter (Handle);
end;2 invocation Print partprocedure TPkFrm.PrintMode2 (psPrintFile: string;
piPrintLabelQty, piPrintBarcodeQty: integer);
var
liOriPrinterIndex: integer;
begin
liOriPrinterIndex: = Printer.PrinterIndex; / / save the original default
printer number, in order to restore
/ / Note, this way printing, printer sequence number automatically assigned to
fight, so do not have to specify a default printer
/ / Per dozen a the content dynamically assigned a default printer
/ / 1 hit label
/ / Label before the first label printer settings to their default values, it
is important to note that this is properly set up to guide the user which is a
label printer
try
Printer.PrinterIndex: = GetPrintIndexFromName (sPrintLabel);
BarCodePrint.LoadFromFile (psPrintFile);
SetLabelColor (CDSMaster.FieldByName ('OldDescr'). AsString);
BarCodePrint.PrepareReport;
/ / Print the number of copies, according to user requirements. Generally print
two copies of single-row, double print a
BarCodePrint.PrintPreparedReport ('', piPrintLabelQty, True, frall)
except
CreateError ('error when printing labels! Number not set correctly label
printer and other reasons', nil, 1);
end;
/ / Call barcode
/ / Playing tag, first hit the bar code printer settings to their default
values, it is important to note that this is set up correctly, to guide the
user which is a bar code printer
try
/ / Printer.PrinterIndex: = iPrintBarcode;
/ / Print the number of copies, according to the label. A label fight two
barcode
WriteToPrinter (sPrintBarcode, CDSMaster.FieldbyName ('NewPkCode'). AsString,
piPrintBarcodeQty); / / bar code printer sequence number, barcode content,
number of copies
except
CreateError ('print bar code wrong! May be a bar code printer number is not set
correct', nil, 1);
end;
/ / Restore to the original default printer settings
try
Printer.PrinterIndex: = liOriPrinterIndex;
except
end;
end Wes Wilson, President ERW Custom Programming, Inc. Crescent Lake Plaza
5459 Elizabeth Lake Rd.
Waterford, MI 48327
(248) 683-4182
www.visual-foxpro-programmer.com
www.erw.com [email protected]
--- StripMime Report -- processed MIME parts ---
multipart/alternative
text/plain (text body -- kept)
text/html
---
_______________________________________________
Post Messages to: [email protected]
Subscription Maintenance: http://mail.leafe.com/mailman/listinfo/profox
OT-free version of this list: http://mail.leafe.com/mailman/listinfo/profoxtech
Searchable Archive: http://leafe.com/archives/search/profox
This message:
http://leafe.com/archives/byMID/profox/[email protected]
** All postings, unless explicitly stated otherwise, are the opinions of the
author, and do not constitute legal or medical advice. This statement is added
to the messages for those lawyers who are too stupid to see the obvious.