loranne
asked on
copy file file1.txt to lpt1
I use a generic printing routine to access shared lasers on the network from withing Foxpro 2.0 Lan:
copy file file1.txt to \\machname\share
I want to use this same command to allow users with local lasers (either on LPT1: or LPT2:) to print to the lasers connected directly to their machines.
If I try to share the local printer, and use the same syntax as above, I get a network error - "The network has responded incorrectly" Abort, Retry, Fail
when printing from the machine with the shared local printer. Yet there are no problems when printing to the share from another machine.
If I try:
copy file file1.txt to LPT1 or
copy file file1.txt to PRN
I get a general failure reading device
Yet if I open the text file in FPro, I can print using the sysmenu to LPT1 or PRN.
The
Run copy file1.txt lpt1
works, but I want to stay away from the DOS Run command.
I do not want to use the
report form test to print
command to accomplish the printing
because some of the files are not created using reports and this would require changing 1000's of lines of code. Any report forms are written to a file.
Does anyone have any suggestions or insights?
copy file file1.txt to \\machname\share
I want to use this same command to allow users with local lasers (either on LPT1: or LPT2:) to print to the lasers connected directly to their machines.
If I try to share the local printer, and use the same syntax as above, I get a network error - "The network has responded incorrectly" Abort, Retry, Fail
when printing from the machine with the shared local printer. Yet there are no problems when printing to the share from another machine.
If I try:
copy file file1.txt to LPT1 or
copy file file1.txt to PRN
I get a general failure reading device
Yet if I open the text file in FPro, I can print using the sysmenu to LPT1 or PRN.
The
Run copy file1.txt lpt1
works, but I want to stay away from the DOS Run command.
I do not want to use the
report form test to print
command to accomplish the printing
because some of the files are not created using reports and this would require changing 1000's of lines of code. Any report forms are written to a file.
Does anyone have any suggestions or insights?
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
To christopherdavis:
I just tried your code in Win 98. It works.
Good Deal. -e2
I just tried your code in Win 98. It works.
Good Deal. -e2
I might be being sillyhere, but what about using
net use lpt1: \\server\share
in a ms-dos command prompt (or even as you setup the printer in control panel)
this will map the network port to the local port. This way all printers are on a lpt1 port regardless of there location.
Easy to do and save messing about in the code, and easy to redirect to a new printer as it's operating system, not foxpro controling it.
Becareful on a novell network with local printing - as it often doesn't work - you have to send it to c:\lpt1 instead (check novells web site for more information)
net use lpt1: \\server\share
in a ms-dos command prompt (or even as you setup the printer in control panel)
this will map the network port to the local port. This way all printers are on a lpt1 port regardless of there location.
Easy to do and save messing about in the code, and easy to redirect to a new printer as it's operating system, not foxpro controling it.
Becareful on a novell network with local printing - as it often doesn't work - you have to send it to c:\lpt1 instead (check novells web site for more information)
Hi, loranne.
While AndyStewart's suggestion has merit, he should not have proposed it as an answer. Locking the question will deny you other responses since most experts completely ignore questions in the "Locked Questions" section.
Unless AndyStewart's response is _exactly_ what you are looking for, please reject AndyStewart's supposed answer.
Bye. -e2
While AndyStewart's suggestion has merit, he should not have proposed it as an answer. Locking the question will deny you other responses since most experts completely ignore questions in the "Locked Questions" section.
Unless AndyStewart's response is _exactly_ what you are looking for, please reject AndyStewart's supposed answer.
Bye. -e2
ASKER
I want to allow users to select printers within my Foxpro programs. To implement your solution I would have to be resetting OS printers constantly for individual users. To implement via Foxpro, I would have to use the DOS run command. I find after repeated use of the DOS command - a memory leak pops up and causes the printing to hang use RUN NET USE. Sorry but your answer is kinda way off base.
ASKER
Thanks for the tip. I have never used type command before. I gave it a quick try and it seems to work!
#Questions
1. What OS are you using for the user's PC?
#Try This
If this code works properly on your system, it should printer out status information. On this PC, I can only test it with "FILE:". Please give me some feedback if this doesn't work.
<---------------- Code Begins ---------------->
* You can replace this with "LPT1:"
cPort = "FILE:"
cPrinter = ""
iNumber_of_Printers = aprinters(gaPrinters)
if iNumber_of_Printers > 0
iElement = ascan(gaPrinters,"FILE:")
if iElement > 0
iRow = ASUBSCRIPT(gaPrinters,iEle
*
cPrinter = gaPrinters(iRow,1)
SET EXCLUSIVE OFF
SET PRINTER TO name (cPrinter)
LIST STATUS TO PRINTER NOCONSOLE
SET PRINTER OFF
SET PRINTER TO
*!* MODIFY FILE c:\testing.txt
endif
endif
<---------------- Code Ends ---------------->
Bye. -e2