Solved

Printing Directly To A Printer VIA Foxpro

Posted on 2011-09-16
6
2,237 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
Comment Utility
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
Comment Utility
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
Comment Utility
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
How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

 

Accepted Solution

by:
gaa18 earned 0 total points
Comment Utility
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
Comment Utility
Yes, the ??? commands have string parameters now. And it must work.
0
 

Author Closing Comment

by:gaa18
Comment Utility
worked it out myself
0

Featured Post

IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
Specific format 21 140
Printing not working on a Toshiba eStudio 232 12 53
C# code editing and collaboration 3 39
Base1 Encode/Decode 3 21
Microsoft Visual FoxPro (short VFP) is a programming language with it’s own IDE and database, ranking somewhat between Access and VB.NET + SQL Server (Express). Product Description: http://msdn.microsoft.com/en-us/vfoxpro/default.aspx (http://msd…
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 fifth video of the Xpdf series, we discuss and demonstrate the PDFdetach utility, which is able to list and, more importantly, extract attachments that are embedded in PDF files. It does this via a command line interface, making it suitable …

771 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

10 Experts available now in Live!

Get 1:1 Help Now