Go Premium for a chance to win a PS4. Enter to Win

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 3072
  • Last Modified:

Printing Directly To A Printer VIA Foxpro

hi all,

i was hoping someone could help me.

we are currently trying to move towards using device fonts on our label printers (Zebra Z4Ms)

i can write a script for output no problem in notepad however when i try to implement it into foxpro it does not function!

i dont know where i am going wrong, if i am calling parameters wrong etc.

if you look at code8207450 you can see the foxpro version and if you look at the 8207451 you can see what i have tested with using notepad.

thanks,

Arran


CLEAR
CLEAR ALL
SET TALK OFF
SET EXACT on

set printer to  name getprinter()
set printer on 
 
USE m:\global\accounts\globalnew IN 0 shared 
select globalnew
GO 136570 

DO WHILE recno()<=136585

SET SAFETY off
copy next 1 to c:\global\hawbb
 
use c:\global\hawbb in 0 exclusive

alter table hawbb add column deldock c(30) 
select hawbb
picad=""
store str(docket_no) to wub
store str(pieces,3) to boc
boc=strtran(boc," ","0")
wub=alltrim(wub)
picad=strtran(picad," ","0")
deldo="FR"
replace deldock with "*"+wub+"-"+picAD+boc+"-"+deldo+"*" 
 
set safety on
******
???
^xa
^lh30,80
^FO20,10^AS,90,90^FD HAWB:+str(docket_no,7)^FS
^FO20,110^AS,35^FD Upper(trim(company))^FS
^FO20,160^AS,35^FD upper(trim(address1))^FS
^FO20,210^AS,35^FD upper(trim(address2))^FS
^FO20,260^AS,35^FD upper(trim(address3))^FS
^FO20,400^AS,35^FD "Contact "+upper(trim(contact))^FS
^FO20,480^AS,90,90^FD1 OF 1^FS
^FO120,650^BC,60^FD upper(deldock)^FS
^XZ


eject page 
****** 
SELECT hawbb
use
SELECT globalnew
 
SKIP
enddo

Open in new window

^xa
^lh30,80
^FO20,10^AS,90,90^FDHAWB:   6627281^FS
^FO20,110^AS,35^FDMCR PRINT^FS
^FO20,160^AS,35^FD11 ENGLISH BUSINESS PARK^FS
^FO20,210^AS,35^FDENGLISH CLOSE^FS
^FO20,260^AS,35^FDHOVE EAST SUSSEX BN3 7ET^FS
^FO20,400^AS,35^FDCONTACT: VICKY DAY^FS
^FO20,480^AS,90,90^FD1 OF 1^FS
^FO120,650^BC,60^FD*6627281-001001-SRA*^FS
^XZ

Open in new window

0
gaa18
Asked:
gaa18
  • 3
  • 2
1 Solution
 
pcelbaCommented:
I don't know what you mean by code8207450 but the ??? command requires a character string as a parameter, so you should provide better format of your commands (or better format of your question).

0
 
gaa18Author Commented:
i was talking about the code snippits.

i dont know what you mean by better format of codes? im just trying to run ZPL code within foxpro?
0
 
jrbbldrCommented:
The following is NOT a Foxpro/Visual Foxpro command:
   ^FO20,400^AS,35^FD "Contact "+upper(trim(contact))^FS

And without quotes around it, it is not 'seen' in FP/VFP as a character string.

If that is a printer 'command' string, and you want to send it to a printer, then you need to first handle it in FP/VFP accordingly.

How you handle the Command String may depend on if you are using a FP/VFP Report Form or not.

Let us know and we'll try to help.

Good Luck
0
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
gaa18Author Commented:
its ok i sussed it! was my error..... as i thought....

this did the trick:


CLEAR ALL
USE m:\global\accounts\globalnew IN 0 SHARED
SELECT globalnew

SET PRINTER on
SET PRINTER TO \\printscanserver\ZebraGen
GO 136580
DO WHILE RECNO()<136590



??? '^xa'
??? '^lh30,80'
??? '^FO20,10^AS,90,90^FDHAWB: '
? docket_no
??? '^FS'
??? '^FO20,110^AS,35^FD'
? space(5)+ Upper(trim(company))
??? '^FS'
??? '^FO20,160^AS,35^FD'
?  space(5)+upper(trim(address1))
??? '^FS'
??? '^FO20,210^AS,35^FD'
?   space(5)+upper(trim(address2))
??? '^FS'
??? '^FO20,260^AS,35^FD'
?   space(5)+upper(trim(address3))
??? '^FS'
??? '^FO20,310^AS,35^FD'
?  space(5)+upper(trim(address4))
??? '^FS'
??? '^FO20,400^AS,35^FDCONTACT: '
?  space(5)+upper(trim(CONTACT))
???'^FS'
??? '^FO20,480^AS,90,90^FD'
?   space(5)+str(GLOBALNEW.PIECES,4)+" of "+str(globalnew.pieces,4)
??? '^FS'
??? '^FO120,650^BC,60^FD'
if upper(trim(globalnew.country))="ITALY" OR upper(trim(globalnew.country))="SWITZERLAND";
OR upper(trim(globalnew.country))="BELGIUM" OR upper(LEFT(globalnew.country,3))="LUX"
?? space(5)+"*"+alltrim(str(globalnew.docket_no))+"*"
endif 
? DOCKET_NO
??? '^FS'
??? '^XZ'
SKIP
enddo

SET PRINTER off
SET PRINTER TO default

Open in new window

0
 
pcelbaCommented:
Yes, the ??? commands have string parameters now. And it must work.
0
 
gaa18Author Commented:
worked it out myself
0

Featured Post

Keep up with what's happening at Experts Exchange!

Sign up to receive Decoded, a new monthly digest with product updates, feature release info, continuing education opportunities, and more.

  • 3
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now