Hello,
I know this is a topic that comes up fairly often but I haven't managed
to get anywhere :(

I have an Epson printer that uses Epson ESC/P2 language. I want to write a
report in ESC/P2 language and send it directly to the printer. I have
written reports in native printer language before but the printers were
always connected locally to a parallel port. After forming the data for the
printer I'd use Foxpro RUN command to copy the data file to the relevant
parallel port.

Now I want to do this to a shared Windows printer. I have set up the printer
on my computer with the "Generic/Text only" driver and now commands such as
"LIST TO PRINTER" come out at draft speed. I always understood the way to
get Foxpro to write directly to the printer was by using the ??? command.
Unfortunately all this does is create a nasty white error box saying "Cannot
write to device PRN ." then causes a GPF.

I am using FPW2.6a, is there a decent way to do what I want? Is it any
easier in later versions of Foxpro? From my experience it does seem as if
there is a massive oversight in the Windows world by assuming that people
will never want to write raw data to a networked printer. Maybe I'm missing
something?

--
Thanks in advance
Andrew Howell

RE: Send data directly to printer on network, FPW2.6a by Leemi

Leemi
Tue May 18 10:06:31 CDT 2004

Hi Andrew:

Have you tried the technique shown in this article?

99595 HOWTO: Use @ ... SAY Commands & Control Codes to Print in FP/W
http://support.microsoft.com/?id=99595

You might also want to try the printing tool on Universalthread.com that
allows one to print in raw mode. I don't know if the code works in FoxPro
2.6, but it is worth looking at.

Go to www.universalthread.com, click on the VFP Zone icon, and choose
Downloads icon. In the ID text box of the query page, search for 9277.

I hope this helps.

This posting is provided "AS IS" with no warranties, and confers no rights.

Sincerely,
Microsoft FoxPro Technical Support
Lee Mitchell

*-- VFP8 HAS ARRIVED!! --*
Read about all the new features of VFP8 here:
http://www.universalthread.com/VisualFoxPro/News/VFP8Release.asp
Purchase VFP8 here:
http://shop.microsoft.com/Referral/Productinfo.asp?siteID=11518

Keep an eye on the product lifecycle for Visual FoxPro here:
http://support.microsoft.com/default.aspx?id=fh;[ln];lifeprodv
- VFP5 Mainstream Support retired June 30th, 2003
- VFP6 Mainstream Support retires Sept. 30th, 2003


>Hello,
> I know this is a topic that comes up fairly often but I haven't managed
>to get anywhere :(

>I have an Epson printer that uses Epson ESC/P2 language. I want to write a
>report in ESC/P2 language and send it directly to the printer. I have
>written reports in native printer language before but the printers were
>always connected locally to a parallel port. After forming the data for the
>printer I'd use Foxpro RUN command to copy the data file to the relevant
>parallel port.

>Now I want to do this to a shared Windows printer. I have set up the
printer
>on my computer with the "Generic/Text only" driver and now commands such as
>"LIST TO PRINTER" come out at draft speed. I always understood the way to
>get Foxpro to write directly to the printer was by using the ??? command.
>Unfortunately all this does is create a nasty white error box saying
"Cannot
>write to device PRN ." then causes a GPF.

>I am using FPW2.6a, is there a decent way to do what I want? Is it any
>easier in later versions of Foxpro? From my experience it does seem as if
>there is a massive oversight in the Windows world by assuming that people
>will never want to write raw data to a networked printer. Maybe I'm missing
>something?



Re: Send data directly to printer on network, FPW2.6a by Andrew

Andrew
Tue May 18 10:44:09 CDT 2004

Lee Mitchell wrote:
> Hi Andrew:
>
> Have you tried the technique shown in this article?
>
> 99595 HOWTO: Use @ ... SAY Commands & Control Codes to Print in FP/W
> http://support.microsoft.com/?id=99595
>

Thanks for the answer, as in my previous post, the third line of this
example:
??? " "
just causes a GPF after telling me "cannot write to device PRN ."

> You might also want to try the printing tool on Universalthread.com
> that allows one to print in raw mode. I don't know if the code works
> in FoxPro
> 2.6, but it is worth looking at.

Looks good, but it's not 2.6 friendly :( First attempt to SET LIBRARY tells
me "Line too long", second attempt tells me "rawprt3.fxp" is not an object
file. So I guess it does some kind of compilation the first time you set a
library..

That said I've found I can do this with reasonable success on 9x and 2k:

(command window)
net use LPT2 \\computername\sharename

(write a file with print code, then in Fox)
RUN copy filewithprintcode.prt lpt2

I'd prefer to do it without using the RUN command but it's better than
nothing and it least it uses the print queue on the print server [so if the
printer is offline the job doesn't stall..]

--
Regards
Andrew Howell



Re: Send data directly to printer on network, FPW2.6a by Neil

Neil
Fri May 21 15:13:40 CDT 2004

Hi Andrew,

I've had this problem with thermal barcode printers and the Zebra EPLII
language before, and the NET USE, RUN COPY solution you mention works fine
on most machines. One other solution that worked _sometimes_ with W2K was to
first send the job to a file, then

** start **
set printer to name <Generic/text only printername>
set console off
set device to printer
set printer on

nfh = fopen(<print job filename>)
do while not feof(nfh)
cLine = fgets(nfh)
? cLine
enddo
= fclose(nfh)

set printer off
set device to screen
set console on
** end **

I've only had moderate success with this (VFP6/7), but it might be worth a
go.

Regards,
Neil

"Andrew Howell" <ajh@work> wrote in message
news:OVS3%238OPEHA.308@TK2MSFTNGP11.phx.gbl...
> Lee Mitchell wrote:
> > Hi Andrew:
> >
> > Have you tried the technique shown in this article?
> >
> > 99595 HOWTO: Use @ ... SAY Commands & Control Codes to Print in FP/W
> > http://support.microsoft.com/?id=99595
> >
>
> Thanks for the answer, as in my previous post, the third line of this
> example:
> ??? " "
> just causes a GPF after telling me "cannot write to device PRN ."
>
> > You might also want to try the printing tool on Universalthread.com
> > that allows one to print in raw mode. I don't know if the code works
> > in FoxPro
> > 2.6, but it is worth looking at.
>
> Looks good, but it's not 2.6 friendly :( First attempt to SET LIBRARY
tells
> me "Line too long", second attempt tells me "rawprt3.fxp" is not an object
> file. So I guess it does some kind of compilation the first time you set a
> library..
>
> That said I've found I can do this with reasonable success on 9x and 2k:
>
> (command window)
> net use LPT2 \\computername\sharename
>
> (write a file with print code, then in Fox)
> RUN copy filewithprintcode.prt lpt2
>
> I'd prefer to do it without using the RUN command but it's better than
> nothing and it least it uses the print queue on the print server [so if
the
> printer is offline the job doesn't stall..]
>
> --
> Regards
> Andrew Howell
>
>



Re: Send data directly to printer on network, FPW2.6a by Neil

Neil
Fri May 21 15:39:49 CDT 2004

Duh! Sorry, forgot the trick that made it work

? cLine + chr(10) && instead of ? cLine

It needed a line feed, but of course this might be different for Epsons

"Neil Waterworth" <nospam-or-nwaterworth@lineone.net> wrote in message
news:%2303MdA3PEHA.2876@TK2MSFTNGP09.phx.gbl...
> Hi Andrew,
>
> I've had this problem with thermal barcode printers and the Zebra EPLII
> language before, and the NET USE, RUN COPY solution you mention works fine
> on most machines. One other solution that worked _sometimes_ with W2K was
to
> first send the job to a file, then
>
> ** start **
> set printer to name <Generic/text only printername>
> set console off
> set device to printer
> set printer on
>
> nfh = fopen(<print job filename>)
> do while not feof(nfh)
> cLine = fgets(nfh)
> ? cLine
> enddo
> = fclose(nfh)
>
> set printer off
> set device to screen
> set console on
> ** end **
>
> I've only had moderate success with this (VFP6/7), but it might be worth a
> go.
>
> Regards,
> Neil
>
> "Andrew Howell" <ajh@work> wrote in message
> news:OVS3%238OPEHA.308@TK2MSFTNGP11.phx.gbl...
> > Lee Mitchell wrote:
> > > Hi Andrew:
> > >
> > > Have you tried the technique shown in this article?
> > >
> > > 99595 HOWTO: Use @ ... SAY Commands & Control Codes to Print in FP/W
> > > http://support.microsoft.com/?id=99595
> > >
> >
> > Thanks for the answer, as in my previous post, the third line of this
> > example:
> > ??? " "
> > just causes a GPF after telling me "cannot write to device PRN ."
> >
> > > You might also want to try the printing tool on Universalthread.com
> > > that allows one to print in raw mode. I don't know if the code works
> > > in FoxPro
> > > 2.6, but it is worth looking at.
> >
> > Looks good, but it's not 2.6 friendly :( First attempt to SET LIBRARY
> tells
> > me "Line too long", second attempt tells me "rawprt3.fxp" is not an
object
> > file. So I guess it does some kind of compilation the first time you set
a
> > library..
> >
> > That said I've found I can do this with reasonable success on 9x and 2k:
> >
> > (command window)
> > net use LPT2 \\computername\sharename
> >
> > (write a file with print code, then in Fox)
> > RUN copy filewithprintcode.prt lpt2
> >
> > I'd prefer to do it without using the RUN command but it's better than
> > nothing and it least it uses the print queue on the print server [so if
> the
> > printer is offline the job doesn't stall..]
> >
> > --
> > Regards
> > Andrew Howell
> >
> >
>
>