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

Programmatically Faxing a Report

Status
Not open for further replies.

dunc0029

Programmer
Jan 9, 2003
45
US
This is my first post, so forgive my inexperience with the forum. I'm a VFP programmer that is temporarily supporting a FPW 2.6 app until we rewrite. I have read through similar postings, but not found an answer (maybe this isn't possible in FPW 2.6?). I can accomplish this in the VFP world.

I would like to have a field (called "printtype" or something), with a value of 1 for Print, 2 for Fax, or whatever. When we process a bunch of groups, we would like to then either fax the report or print it, as derived from this field.

I am running Win 2k and our Fax print driver is called "MM Fax Print Driver" and the port is called FAXSRVR (which is checked for MM Fax Printer Driver) OR FAXSRVR: (which is not checked, and indicated as Local Port).

If I do a SYS(1037), select the driver and print, it brings up our Faxing software, which is what I want. However, trying to:

SET PRINTER TO FAXSRVR:
SET PRINTER ON

gives me the "printer not ready" error

SET PRINTER TO FAXSRVR just creates a file called FAXSRVR
SET PRINTER TO "FAXSRVR:" seems to do nothing...

Is there any way to do this??? Do I HAVE to run an external command to set the default windows printer?

Your help would be MUCH appreciated. Thanks!
 
As you have discovered the SET PRINTER TO syntax doesn't work in FPW like it does in VFP.

You can use the code supplied by MS in Knowledge Base Article Q103645 - "HOWTO: Change the Default Windows Printer from FoxPro" at Contrary to what it say's it does work in Win95/98, but it occasionally corrupts the Win.ini file - I usually saved off a copy of this file just in case.

Rick
 
Thanks! That did the trick and I will go with that if there isn't a more ideal solution. The only downside is that anything the user would be simultaneously printing would use this printer, as well. Also, if there's any kind of security on the WIN.INI files, this probably won't work.

Is there ANY way to use SET PRINTER TO so that only the FoxPro system would be affected? It seems inconsistent I can use sys(1037) to select the FAX driver or network printer, but can't do that programmatically.
 
Well I never found any other solution in FPW - one reason to move up to VFP! Note: Once you are done printing in your app, you could always set it back to the "right" default to minimize the likehood of causing other apps problems.

Rick
 
Well, thanks very much for you help! We'll go with this solution for now. I started here about 5 months ago and inherited some real headaches - I'm totally on my own as the only IS person with no documentation. I wish we were in VFP - I'm much more experienced with that and finding a lot of frustrating dead ends in FPW. Actually, the whole system (and 2 VFP apps) will be rewritten in Java/Oracle in the next few years and I'm the lucky guy that will get to do it. Thanks again!

Jason
 
Hi dunc0029

I have been using winfax to fax out POs. for my client. The requirement was that to pass the suppliers fax number from a SUPPLIER table and we have to fax out 20 to 30 in a row. You can go thru how to pass control thru DDE in winfax, you should be able to do so.

In case you want a program listing, call me at
rich110@email.com

 
I'm glad that the WinFax solution is working out for you.

You say: "I can use sys(1037) to select the FAX driver or network printer, but can't do that programmatically."

When you use it programmatically you need to use it in a manner similar to the following:
=SYS(1037)
or
nRet = SYS(1037)
or in some such manner.

It works well within an FPW application to programmatically allow the user to select their desired printer - as many of my clients can attest.

The only strange thing about it is if the user clicks on the Cancel button and expects it to cancel the printout - it will not. You will need to handle that yourself with separate programming.

Good Luck,
JRB-Bldr
VisionQuest Consulting
Business Analyst & CIO Consulting Services
CIOServices@yahoo.com
 
I'm using a utility from Abri Technologies, called FPW Printer Select, which handles this all through code, and stores the printer information you need in a small dbf. I've been using it for several years and it works on Win9x, Win2k, and XP.

Here's a link to it:
Wayne Stahnke,
OM-Software
 
Sorry it took me a while to respond. I was in class all last week. Thanks for the responses.

To jrbbldr - Thanks, but I realize I can programmatically call SYS(1037). If possible, I don't want to have a user interactively select the Fax Driver. Ideally, I'd like a totally automated job that would fax, email or print the reports depending on a field.

To WaneWrld - I downloaded the trial and it worked! From the README file, it seems like they're just reassigning the WINDOWS default printer temporarily, which may be what I have to do.

Ideally, I want some command like SET PRINTER TO FAXSRVR:. Is there ANY WAY to do this? Can I do a SET PRINTER TO in FoxPro Windows 2.6 under Windows 2000? This is not a HUGE deal - we've been getting along without it and the system is going to be rewritten sooner rather than later. It just seems fishy to me that I can do a =SYS(1037) and print to that driver, but can't say &quot;SET PRINTER TO <>&quot; and do the same thing.

Thanks again for all your help!

Jason
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top