Solved

Printing Directly To A Printer VIA Foxpro

Posted on 2011-09-16
6
2,322 Views
Last Modified: 2012-06-27
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
Comment
Question by:gaa18
  • 3
  • 2
6 Comments
 
LVL 41

Expert Comment

by:pcelba
ID: 36548241
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
 

Author Comment

by:gaa18
ID: 36548284
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
 
LVL 12

Expert Comment

by:jrbbldr
ID: 36548802
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
PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

 

Accepted Solution

by:
gaa18 earned 0 total points
ID: 36549186
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
 
LVL 41

Expert Comment

by:pcelba
ID: 36551748
Yes, the ??? commands have string parameters now. And it must work.
0
 

Author Closing Comment

by:gaa18
ID: 36898831
worked it out myself
0

Featured Post

DevOps Toolchain Recommendations

Read this Gartner Research Note and discover how your IT organization can automate and optimize DevOps processes using a toolchain architecture.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

When I recently replaced my image transfer kit on my office HP color laserjet 5550dn printer, I had a slight problem.  The left bracket that holds the transfer kit got stuck in the upright locked position instead of being at a 45 degree angle facing…
This article will show, step by step, how to integrate R code into a R Sweave document
An introduction to basic programming syntax in Java by creating a simple program. Viewers can follow the tutorial as they create their first class in Java. Definitions and explanations about each element are given to help prepare viewers for future …
In this fourth video of the Xpdf series, we discuss and demonstrate the PDFinfo utility, which retrieves the contents of a PDF's Info Dictionary, as well as some other information, including the page count. We show how to isolate the page count in a…

867 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

24 Experts available now in Live!

Get 1:1 Help Now