Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Run command

Status
Not open for further replies.

JDurbin

Programmer
May 17, 2000
341
US
I used ! or RUN to make the following work in 2.6 but VFP is different and it won't work. Now I'm trying the ??? in VFP. Maybe its just buffered or something.

! COPY MyFile LPT2
??? lcFile

Maybe I should explain what I'm doing. I'm sending printer codes to an Eltron barcode printer. It's worked fine in 2.6 with RUN. The app is for a single label. The "form" is downloaded to the printer with "variables." Anyway, what's the best way to do this in VFP? This is the only app I've had to work with sneding printer codes. John Durbin
MCP Visual FoxPro
ICQ VFP ActiveList #73897253
 
I'm already building the string so I figured I'd just work with the local var holding it; lcString or lcFile whatever

Examples
?? "hello world" doesnt work

??? "hello world" spools. Checking the printer spooler it even states the Status as Spooling. Got weird responses. Sometimes after quitting VFP it would print, sometimes not.

I read something about RUN working different with DOS commands in VFP that FPW. ! COPY myfile LPT1 works in 2.6 but not VFP :( John Durbin
MCP Visual FoxPro
ICQ VFP ActiveList #73897253
 
John, Took me a little while to find these routines in my archived files but I think this do what you want. You will have to change the code to go from LPT1 to LPT2.

The routine ASCPRT takes a Text.txt file as a parameter and prints it to a printer. The routnine ERRPRNW is called by ASCPRT if it gets an error on the printer port.

David W. Grewe
Dave@internationalbid.com
ICQ VFP ActiveList #46145644
 
Hi all,

I have a problem similar to what John Durbin described above. I was glad to see I might find an answer here, but the links that Dave Grewe posted back in Feb, 2001 don't work for me.

Perhaps someone can offer some advice. I have an old Foxpro app that I am converting to VFP 7.0. One of the things it does it create a special report that is actually a file full of printer command codes and some data that I need to send directly to a windows printer. I cannot rewrite it as a vfp report because it must look exactly as it does now with data superimposed on a form that was meticulously programmed by a predecessor of mine combining the contents of an adobe acrobat form and data brought in from the application superimposed on it. (IN other words, I can't mess with it and just need to find a way to get it to print.

In the old dos foxpro version 2.5 software it worked just fine with the command

run copy /B c:\foxwork\printer.out LPT2:

I tried TYPE c:\foxwork\printer.out TO PRINTER but it prints the actual contents of the file instead of interpreting them and printing as it should.

I also tried this series of code and the same thing happened:

cString = FileToStr("c:\foxwork\printer.out")
SET PRINTER TO NAME GETPRINTER()
SET PRINTER ON
? cString
EJECT
SET PRINTER OFF

Does anyone perhaps have a suggestion for how I might accomplish this or what I might be missing here?

Thanks in advance for any help you can offer.

Julie
 
Julie,

I strongly recommend you start a new thread and just reference this one. Many very helpful people are going to ignore your question just because they won't look at a three year old thread on RUN.

Brian
 
JulieAB,

baltman's advice is right. Anyway, to answer your question, you have to use the 'Generic / Text Only' printer driver if you want to send printer control codes to your printer under Windows. This will cause the printer to interpret the codes instead of trying to print them out.

HTH
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top