turn123
asked on
How do I print using a windows print driver?
Basicly my problem is that I have a file with fax numbers and faxes that they need to be sent to. Since it appears that there isn't a good way to send faxes with Perl on Win200 and XP I want to print the the Windows fax program and let it handle sending the faxes.
Any suggestions on how to do this?
Thanks in advance,
Turn123
Any suggestions on how to do this?
Thanks in advance,
Turn123
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Saw that but I don't see how to choose to print the the fax printer or pass the fax number.
You can choose which printer to use by passing the "printer" parameter to new(), as in "printer => 'fax", where 'fax' is the name listed in your printers folder.
AFAIK, the only way to pass the fax number to a windows fax/printer driver is for the user to type it in - the fax driver has to fit into the printer API, and printers don't need telephone numbers. I'm not an expert on W32 printing, so maybe there's some undocumented call or something, but I doubt it.
I don't know of and can't find any perl modules for sending faxes with a modem, I think your best chance might be to use an e-mail to fax gateway, of which there are many around. Otherwise, the only other thing I can think of is using a command-line program to send to fax, which you could easily call from Perl. Unfortunatley, I'm not aware of any such program for Win32, although there are plenty for unix (efax, hylafax, netfax).
AFAIK, the only way to pass the fax number to a windows fax/printer driver is for the user to type it in - the fax driver has to fit into the printer API, and printers don't need telephone numbers. I'm not an expert on W32 printing, so maybe there's some undocumented call or something, but I doubt it.
I don't know of and can't find any perl modules for sending faxes with a modem, I think your best chance might be to use an e-mail to fax gateway, of which there are many around. Otherwise, the only other thing I can think of is using a command-line program to send to fax, which you could easily call from Perl. Unfortunatley, I'm not aware of any such program for Win32, although there are plenty for unix (efax, hylafax, netfax).
ASKER
mishagale,
Thanks.
I'm going to leave this open for a while to see if anyone can suggest a command line fax program or something else that would work well.
Turn123
Thanks.
I'm going to leave this open for a while to see if anyone can suggest a command line fax program or something else that would work well.
Turn123
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Is COM just a followup to OLE? In that case, the Win32::OLE module may be able to accomplish the equivalent of the Visual Basic code from the Microsoft Knowledge Base. The names remain the same, you just have to overcome the syntax differences.
ASKER
jmcg,
Thanks for looking at this question.
When you say faxcom Are you referring to this product?
http://www.biscom.com/Merchant2/merchant.mv?Screen=CTGY&Store_Code=B&Category_Code=SBE
If so that is way out of my budget.
I do have a copy of Winfax pro so I'll look and see if I can find anything to work with that.
Turn123
Thanks for looking at this question.
When you say faxcom Are you referring to this product?
http://www.biscom.com/Merchant2/merchant.mv?Screen=CTGY&Store_Code=B&Category_Code=SBE
If so that is way out of my budget.
I do have a copy of Winfax pro so I'll look and see if I can find anything to work with that.
Turn123
It was my impression that these were Microsoft DLLs available on the install disk or for free download, but - since I'm not much of a Windows wiz, I can't say so with much authority. The WinFAX pro product might have a different way for you to send a fax from "the command line" or "in batch mode" -- you'd need to look at the product's documentation.
ASKER
jmcg and mishagale,
Thank you very much for your help.
After looking around I found that Winfax had a SDK so I was able to use that to send a fax.
Here is the basic code that I got working to send a fax:
use OLE;
use strict;
my $fax;
my $fax = Win32::OLE->new("WinFax.SD KSend") || die $!;
$fax->SetSubject("test");
$fax->SetNumber("8868526") ;
$fax->SetAreaCode("706");
$fax->SetCompany("OWPI");
$fax->AddRecipient();
$fax->LeaveRunning();
$fax->SetCoverText("Hi this is a test\n\nDid it work?");
$fax->Send(1);
print $fax->IsError();
and a link to the documentation...
ftp://ftp.symantec.com/misc/sabu/winfax/wfxsdk.pdf
Mabey in the future this will save someone a lot of time.
Now to get it working with my script :-).
Thanks again to both of you for your help.
Turn123
Thank you very much for your help.
After looking around I found that Winfax had a SDK so I was able to use that to send a fax.
Here is the basic code that I got working to send a fax:
use OLE;
use strict;
my $fax;
my $fax = Win32::OLE->new("WinFax.SD
$fax->SetSubject("test");
$fax->SetNumber("8868526")
$fax->SetAreaCode("706");
$fax->SetCompany("OWPI");
$fax->AddRecipient();
$fax->LeaveRunning();
$fax->SetCoverText("Hi this is a test\n\nDid it work?");
$fax->Send(1);
print $fax->IsError();
and a link to the documentation...
ftp://ftp.symantec.com/misc/sabu/winfax/wfxsdk.pdf
Mabey in the future this will save someone a lot of time.
Now to get it working with my script :-).
Thanks again to both of you for your help.
Turn123
I'm bookmarking this one. Thanks for letting us know (and for pointing people who found your other question on this subject here).
ASKER
Do you have some code showing how I would use this?
Turn123