Alpha Video Training
Results 1 to 16 of 16

Thread: Winfax ole help

  1. #1
    "Certified" Alphaholic
    Real Name
    Russ Boehle
    Join Date
    Mar 2000
    Location
    Connecticut
    Posts
    2,767

    Default Winfax ole help

    I am trying to get winfax ole to work. I am unfamiliar with the syntax. I have put in the following for the function winfaxole:

    WinfaxOLE(topparent:Fax_no,report,:fax_test," "," ")

    where Fax_no is a field on a test form
    report named Fax_test
    At this point I don't care about filter or order.

    When I press the button for this code I get fax_test not found. I have played with the syntax on fax_test but can't get it to work. I am stumped on this.

    Any help on this would be appreciated.


    This is Selwyn's post on the xbasic for the function.

    'Here is a sample script that is actually part of A5 that shows how we used OLE Automation to control Winfax:

    'In the function, Obj_type is "report", "Label", "letter" etc. and Obj_name is the name of the object. E.g. the "customer_list" report.

    'filter_str is the filter for the report, and order is the order for the report.

    function WinfaxOLE as L(fax_num as C,obj_type="",obj_name="",filter_str="",order="")

    dim eval_str as c 'strings for the print driver setup
    dim saved_output_file as c
    dim saved_driver as c

    dim areacode as c

    dim Winfaxsend as p
    Winfaxsend = ole.create("Winfax.SDKSend8.0")

    Winfaxsend.SetUseCover(1)

    'set the number of the recipient
    Winfaxsend.addrecipient()

    'see if there is an area code
    if len(fax_num) > 7 then
    areacode = left(fax_num,3)
    faxnum = right(fax_num,7)

    Winfaxsend.SetAreaCode(areacode)
    end if

    Winfaxsend.SetNumber(fax_num)

    Winfaxsend.removerecipient() 'these two lines are necessary because of Winfax's interface
    Winfaxsend.addrecipient()

    'attach the file
    Winfaxsend.SetPrintFromApp(1) 'tells Winfax to expect something from the printer driver

    'print to the Winfax driver
    saved_output_file = ":" + obj_type + ".output_file_override(\"\\temp.rtf\")"

    saved_driver = ":" + obj_type + ".printer_override(\"Winfax\")"

    print = obj_type + ".print(\"" + obj_name + "\",\"" + filter_str + "\",\"" + order +"\")"

    eval(saved_driver)

    eval(print)

    restore_output_file = ":" + obj_type + ".output_file_override(\"\")"

    restore_driver = ":" + obj_type + ".printer_override(\"\")"

    eval(restore_output_file)

    eval(restore_driver)

    'send
    Winfaxsend.send(0)

    'for Winfax cleanup
    Winfaxsend.done(1)

    'delete the Winfax object
    delete Winfaxsend

    end functionFUNCTION Winfax AS L ( )
    END FUNCTION

  2. #2
    Tim Stephens
    Guest

    Default RE: Winfax ole help

    if the field fax_no on your form is a character field then
    use ...

    WinfaxOLE(topparent:Fax_no.value,"report","fax_test")

    otherwise if numeric you must change it to character so use

    WinfaxOLE(str(topparent:Fax_no.value),"report","fax_test")

    I haven't tested this but it should work.

    Tim

  3. #3
    "Certified" Alphaholic
    Real Name
    Russ Boehle
    Join Date
    Mar 2000
    Location
    Connecticut
    Posts
    2,767

    Default RE: Winfax ole help

    Thank you, I'll try this and let you know if it works.

    Russ

  4. #4
    "Certified" Alphaholic
    Real Name
    Russ Boehle
    Join Date
    Mar 2000
    Location
    Connecticut
    Posts
    2,767

    Default RE: Winfax ole help

    Tim,
    That almost does it. The controller starts but I get an error "report not found fax_test"
    I will play with it more. I wonder if I need a full path for the report? Doesn't seem I should as it is in the same directory. Any ideas?

    Russ

  5. #5
    "Certified" Alphaholic
    Real Name
    Russ Boehle
    Join Date
    Mar 2000
    Location
    Connecticut
    Posts
    2,767

    Default RE: Winfax ole help

    I'm making progress but mostly by trial and error.
    The following script sort of works:

    WinfaxOLE("1"+remspecial(topparent:Fax_no.value),"report","Fax_test")

    When I click the button it starts the winfax controller if it is not already started, then the Winfax Pro filler pops up. This is to add or paste a cover page, even though in the program comfiguration I have it set to no cover page. It appears there must be a switch to not require a cover page.

    Then if I put in some text and continue it tries to dial, but with a blank phone number string. If I cancel it does this twice. On the third try it dials the number but adds an 81 between the 1 and the rest of the number. I have no idea where this is coming from. It tries to dial:
    1818606846354 when I put in the number 860-684-6354 as the fax number. Does anyone know where the 81 comes from or about a switch for cover pages. There doesn't appear to be anything in Winfax help on this.

  6. #6
    Tim Stephens
    Guest

    Default RE: Winfax ole help

    Ok, about the cover page.

    Notice in Selwyn's function that you posted above, right near the top is the line:
    Winfaxsend.SetUseCover(1)

    If were to change that line to
    Winfaxsend.SetUseCover(0)
    the cover page shouldn't pop up.

    Now, about the number.
    Selwyn's code assumes that the number string contains no other characters. eg) the number 860-684-6354 should be written as "8606846354" (remspecial() should work fine but you dont need to add the "1")

    If the phone number is bigger then 7 digits (as in your case) the function takes the first 3 digits and sets that as the area code, then the last 7 digits make up the fax number.


    Again, I can't test this out since I don't have winfax.

  7. #7
    "Certified" Alphaholic
    Real Name
    Russ Boehle
    Join Date
    Mar 2000
    Location
    Connecticut
    Posts
    2,767

    Default RE: Winfax ole help

    Tim,
    I shouldhave noticed the cover page(1) in Selwyns code. I added the 1 because winfax is set up as "dial as enterd" so it won't add the 1.
    Do you know what the advantage of ole over DDE is?
    I also can fax from alpha using Winfax DDE and this is easier (for me) and works fine. I just thought I'd try to get it to work in OLE as Selwyn says it's better. The only advantage I can see is that it allows record selection and filtering of the report where with DDE the report has to be be fully formatted and described in the report designer. OLE seems to be more complicated.

    Thanks for the help,

    Russ

  8. #8
    Tim Stephens
    Guest

    Default RE: Winfax ole help

    OLE gives you much more control over an application, with OLE you can create an instance of an application, populate the application with filtered data, calculations, etc.. save and close the application all behind the scenes and invisible to the end user.

    Basically it gives the developer the power to do a lot of things without the end user ever know how or what is going on.

  9. #9
    "Certified" Alphaholic
    Real Name
    Russ Boehle
    Join Date
    Mar 2000
    Location
    Connecticut
    Posts
    2,767

    Default RE: Winfax ole help

    That sounds interesting, I'll have to see if symantec has any info on OLE with winfax. It seems though that most (but not all)of this can be done by setting things up properly with a table and report before printing and then using DDE.

    Thanks
    Russ

  10. #10
    "Certified" Alphaholic
    Real Name
    John Koh
    Join Date
    Jan 2004
    Location
    Maryland, USA
    Posts
    1,084

    Default Re: Winfax ole help

    Russ and Tim

    I have an Error Message as "Command: eval(print) not found report not found".

    A part of the Button Scripts
    Code:
    'Preview a report layout Filter. You can specify which records to preview.
    	query.filter = "Proposalamt->Proposalamt_id = Var->vGet_Proposalamt_Id"
    	query.order = "recno()"
    'replace variables in the filter with their actual values	
    	query.filter = convert_expression(query.filter,"V")
    
    
    'Get the fax number from current table
    	FaxNumbers()
    
    'Open the Winfax and Fax it
    	winfaxprint(vfaxnum,"report","Proposal",query.filter,query.order)
    WinfaxPrint -- a part of OLE UDF, same scripts as Russ's
    Code:
    'print to the Winfax driver
    saved_output_file = ":" + obj_type + ".output_file_override(\"\\temp.rtf\")"
    saved_driver = ":" + obj_type + ".printer_override(\"Winfax\")"
    
    print = obj_type + ".print(\"" + obj_name + "\",\"" + filter_str + "\",\"" + order +"\")"
    eval(saved_driver)
    eval(print)
    
    restore_output_file = ":" + obj_type + ".output_file_override(\"\")"
    restore_driver = ":" + obj_type + ".printer_override(\"\")"
    
    eval(restore_output_file)
    eval(restore_driver)
    Does this script "Winfaxprint(vfaxnum, "report", "Proposal", query.filter, query.order)" refer(match) to it
    print = obj_type + ".print(\"" + obj_name + "\",\"" + filter_str + "\",\"" + order +"\")"
    ?

    Do you know what the error mean?

  11. #11
    "Certified" Alphaholic Stan Mathews's Avatar
    Real Name
    Stan Mathews
    Join Date
    Apr 2000
    Location
    Bowling Green, KY
    Posts
    25,119

    Default Re: Winfax ole help

    The error says the report is not found. Check your use of the function.

    WinfaxOLE(fax_num,obj_type,obj_name,filter_str,order)

    what values are you supplying for the parameters, especially obj_name?
    There can be only one.

  12. #12
    "Certified" Alphaholic
    Real Name
    John Koh
    Join Date
    Jan 2004
    Location
    Maryland, USA
    Posts
    1,084

    Default Re: Winfax ole help

    Hi Stan,

    "Proposal" -- winfaxprint(vfaxnum,"report","Proposal",query.filter,query.order)

    When I tested and used only a command winfaxprint("301 555 1234","report","Proposal",vfilter,vorder), WinfaxPrint() UDF opens the Winfax program with all of my proposals and no Fax number. So I assume the WinfaxPrint() udf is fine except "Filter and Fax Number" problem.
    Last edited by johnkoh; 11-30-2010 at 08:40 PM.

  13. #13
    "Certified" Alphaholic Stan Mathews's Avatar
    Real Name
    Stan Mathews
    Join Date
    Apr 2000
    Location
    Bowling Green, KY
    Posts
    25,119

    Default Re: Winfax ole help

    Is proposalamt_id a character value?

    Try

    query.filter = "Proposalamt->Proposalamt_id = "+quote(Var->vGet_Proposalamt_Id)


    Also vGet_Proposalamt_Id must be dimmed as shared or global for convert_expression to "see" its value, I think.
    Last edited by Stan Mathews; 12-01-2010 at 10:12 AM.
    There can be only one.

  14. #14
    "Certified" Alphaholic
    Real Name
    John Koh
    Join Date
    Jan 2004
    Location
    Maryland, USA
    Posts
    1,084

    Default Re: Winfax ole help

    Good morning Stan,

    Thank you for your help.

    After added and wrote the new button scripts, the UDF (WinfaxPrint()) opened a Winfax Program but It did not insert the Fax number and Alpha indicated an error as - Command: Winfaxsend.done(1) OLE Automation Error: Bad parameter count.

    Code:
    DIM Shared vGet_Proposalamt_Id AS C
    vGet_Proposalamt_Id = tbl.eval("Proposalamt_Id")
    
    tbl.close()
    'Find a Proposal before Print
    dim shared vFilter as c
    dim shared vOrder as c
    vFilter = "Proposalamt->Proposalamt_id = Var->vGet_Proposalamt_Id"
    vOrder = "Recno()"
    
    'Get the Fax Number from Bidder List table
    'Deleted the Get Fax UDF for Test FaxNumbers()
    
    'Execute the WinfaxPrint(OLE) 
    dim shared vFaxNum as c
    vFaxNum ="3015551234"
    WinfaxPrint(vFaxNum,"report","proposal",vFilter,vOrder)
    Is the vFaxNum suppose list on the Winfax sending form?

  15. #15
    "Certified" Alphaholic Stan Mathews's Avatar
    Real Name
    Stan Mathews
    Join Date
    Apr 2000
    Location
    Bowling Green, KY
    Posts
    25,119

    Default Re: Winfax ole help

    Is the vFaxNum suppose list on the Winfax sending form?
    I would think so but I have no experience with it. Just trying to help you with the code.

    What happens if you change

    Code:
    WinfaxPrint(vFaxNum,"report","proposal",vFilter,vOrder)
    to

    Code:
    WinfaxPrint("3015551234","report","proposal",vFilter,vOrder)
    and leave everything else the same.
    There can be only one.

  16. #16
    "Certified" Alphaholic
    Real Name
    John Koh
    Join Date
    Jan 2004
    Location
    Maryland, USA
    Posts
    1,084

    Default Re: Winfax ole help

    Stan,

    Nothing, Winfax Send form was not inserted the Fax number.

Similar Threads

  1. Winfax OLE
    By russ Boehle in forum Alpha Five Version 6
    Replies: 4
    Last Post: 11-02-2004, 09:15 AM
  2. Winfax scripts not working in Win XP Pro
    By Rick Valenzuela in forum Alpha Five Version 5
    Replies: 3
    Last Post: 02-09-2004, 06:01 PM
  3. problems between winfax and a5
    By Kevin Morken in forum Alpha Five Version 5
    Replies: 3
    Last Post: 01-30-2003, 02:15 AM
  4. WinFax 9.02 DDE
    By Jim Rowlen in forum Code Archive
    Replies: 3
    Last Post: 03-17-2000, 04:30 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •