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 Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to text file using printer name in dos

Status
Not open for further replies.

skyyonk

Programmer
May 6, 2002
23
0
0
SG
I need to print a text file in dos but i do not want to hardcode the path to filename > lpt1

I need something like this:

filename > printer name

anyone can help??
 
are you doing this from dos, foxpro, or using the fox run command? Attitude is Everything
 
i am doing this from foxpro 6.0 using fox run command
 
cProgPath = sys(2003) &&& the location where the program loaded. assuming that you have set folders that hold the files. assign them to a var. like a sub folder under program folder

cpath = cProgPath + 'txtfil
run type (cpath) > lpt1
run type &cpath > lpt1
Attitude is Everything
 
Thanx danceman.

cpath = cProgPath + 'txtfil
run type (cpath) > lpt1
run type &cpath > lpt1

i do not wish to hardcode the output to lpt1
i would prefer to use printer name instead.
e.g. my printer name is bill so i would need something like this.

run type (path) > bill (this is not working in dos)
 
Thanx danceman.

cpath = cProgPath + 'txtfil
run type (cpath) > lpt1
run type &cpath > lpt1

i do not wish to hardcode the output to lpt1
i would prefer to use printer name instead.
e.g. my printer name is bill so i would need something like this.

run type (path) > bill (this is not working in dos)

you have any solution which i can use printer name instead?
 
Redirect output to a file and print this file with vfp.
Code:
run type (path) > output.txt
SET PRINTER TO NAME WindowsPrinterName
TYPE output.txt TO PRINTER
hope this helps
Andreas
 
ehm...

Didn't use my brain... don't redirect to a file... just print out the file itself...
Andreas
 
HI

TYPE FileName1 TO PRINTER
OR
TYPE FileName1 TO PRINTER PROMPT

Here PROMPT will bring up the windows dialogue to select the printer.

OR you can code it as..

myPrinter = "printerNAME" or network printer name.. example \\Bill whatever..

SET PRINTER TO (myPrinter)
TYPE FileName1 TO PRINTER

Hope this helps you :) ramani :)
(Subramanian.G),FoxAcc, ramani_g@yahoo.com
 
By the way,

When the file contains binairy code (OK, not in this question), TYPE won't work, but

aa=filetostr('drive:\path\filename')
??? aa

will.

 
Followed by
Set printer to default
to eject the last page of course.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top