Solved

Printing Directly To A Printer VIA Foxpro

Posted on 2011-09-16
6
2,400 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
Master Your Team's Linux and Cloud Stack!

The average business loses $13.5M per year to ineffective training (per 1,000 employees). Keep ahead of the competition and combine in-person quality with online cost and flexibility by training with Linux Academy.

 

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

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.

Question has a verified solution.

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

Printers have changed substantially in the last 30 or so years, not just in technical capabilities but in cost and usage as well.  Printers were originally used for interfacing with the operator, not necessarily for printing copy or pictures. In …
Since upgrading to Office 2013 or higher installing the Smart Indenter addin will fail. This article will explain how to install it so it will work regardless of the Office version installed.
Viewers will learn how to properly install Eclipse with the necessary JDK, and will take a look at an introductory Java program. Download Eclipse installation zip file: Extract files from zip file: Download and install JDK 8: Open Eclipse and …

773 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