Using Foxpro to print an ASCII text file that contains printer control characters

I have an old Foxpro program that creates an ASCII text file that contains printer control characters.  Presently the end users select a default printer from with in the program, this captures an LPT port and I simply copy the text file to the LPT port and it prints.  (Basic DOS print)  However I have recently been running into a network security issue with certain users that are not able to capture/redirect to the LPT port.
Because I am not a domain admin on this particular network troubleshooting this is difficult....but I thought I would update the program and try to use the Windows interface, like a common dialog box on the form where a user can select their default printer instead of using the LPT capture.  However I am running into difficulty for example if I use somthing like the 'TYPE' command to output the file to the printer, it does not recognize the ASCII spaces embedded in the file correctly so nothing on the report lines up...it looks like crap.  I am trying to avoid creating a very detailed report template in Foxpro for this...there are just so many fields and tables it would take hours.  Is there a way to simply print an ASCII text file with embedded printer control characters from FoxPro using the Windows common dialog or other command?  Any feedback would be greatly appreciated.  PCELBA....I could use your help on this one.
LVL 11
Patmac951Asked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

CaptainCyrilFounder, Software Engineer, Data ScientistCommented:
I don't know how your program is done but the way I did it as follows:

1) Send the report with Control Characters to a text file
2) Run a DOS Shell and print that file to a port: PRINT trialbal.txt > lpt1:

This way it prints much faster specially if the report is big. I am talking 700+ pages.
0
Patmac951Author Commented:
Thanks for reply Captain.  Your reply is basically what I have been doing with this program for the last 10 or 12 years, printing via DOS. This program is installed in a large company of over 300 users and the majority of the users work fine using my DOS print procedure.  However there are some computers on the network that will not allow an LPT capture unless the user is a local admin.   Secondly I am trying to convert the program to print the ASCII file via the true Windows interface so remote users via RDP can print to their locally installed printers.  I am really hoping to find a true Windows solution to this without having to use the old DOS technique.
0
GreatSolutionsC.I.OCommented:
Hi Patmac

Use the ??? command, like in:
set printer to GetPrinter()
??? "Your ASCII String here"
** or **
??? FiletoStr( YourAsciiFile )
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
FoxPro

From novice to tech pro — start learning today.