home *** CD-ROM | disk | FTP | other *** search
/ Programmer 7500 / MAX_PROGRAMMERS.iso / CLIPPER / DATABASE / MYB_203.ZIP / MYB_203.EXE / FAX.MRG < prev    next >
Encoding:
Text File  |  1993-05-04  |  4.0 KB  |  106 lines

  1. <*
  2.    FAX.MRG - Sample merge print file for CONTACT database.
  3.    ~~~~~~~
  4.    This is an example of how you may feed data to, and call external
  5.    programs from within MyBASE while merge printing.
  6.  
  7.    Using this program you may merge and fax truly personalized documents to
  8.    multiple destinations. This merge program first creates the document
  9.    and then calls an external program (BITFAX for DOS) to fax the document
  10.    via a fax/modem. Although in this example BITFAX is used for transmitting,
  11.    other fax software may work equally as well.
  12.  
  13.    NOTE: Statements below which begin with the hash mark (#) are only
  14.    evaluated ONCE! However, since the results of each of these functions is
  15.    assigned to a memory variable, they may be used later without needing
  16.    to re-evaluate the entire function (much faster).
  17.  
  18.    ** Note also that code blocks always need to be pre-processed!
  19.  
  20. >
  21. <# _Date      := CMONTH(DATE()) +" "+ ALLTRIM(STR(DAY(DATE()))) +","+ STR(YEAR(DATE())) >
  22. <# _To        := "" > <* create a memory variable to hold the name of
  23.                          the person being faxed >
  24. <# _DoNothing := {|| NIL} >                            <* this is a code block >
  25. <# _SkipThis  := {|| .not. FAX .or. EMPTY( FAX_NO )} > <* ...and so is this    >
  26. <*
  27.  
  28.    The following statement uses the code blocks which have been defined above
  29.    to skip all records which do not have a fax number "EMPTY( FAX_NO )" or
  30.    which have been flagged as 'do not fax' ".not. FAX"
  31.  
  32. >
  33. < DBEVAL (_DoNothing,, _SkipThis,, .T.) >
  34.  
  35.  
  36.  
  37.                                                           John Smith
  38.                                                           XYZ Company Inc.
  39.                                                           101 Street Avenue
  40.                                                           Anywhere, Anystate
  41.                                                           12345
  42.  
  43.                                                           Tel. (999) 555-1212
  44.  
  45.  
  46.  
  47. < _Date >
  48.  
  49. < TRIMLINES (
  50.      TRIM (TRIM (SAL) +" "+ FIRST_NAME) +" "+ LAST_NAME + _LF +
  51.      TITLE     + _LF +
  52.      DEPARTMENT+ _LF +
  53.      COMPANY   + _LF +
  54.      ADDRESS_1 + _LF +
  55.      ADDRESS_2 + _LF +
  56.      TRIM (CITY)+ ", " + STATE + _LF +
  57.      ZIP_CODE  + _LF )
  58. >
  59.  
  60. Dear < _To := IF( EMPTY(LAST_NAME), "Sir/Madam", TRIM (TRIM (SAL)+" "+LAST_NAME)) >,
  61.  
  62.    *******************
  63.  
  64.           TEXT
  65.  
  66.    *******************
  67.  
  68.  
  69. Yours very truly,
  70. <*
  71.    The next line is a BITFAX command which will pull-in an external file
  72.    into this document. In this case a PCX signature will be inserted in
  73.    this spot. You can use the same idea to add a company logo to the top of
  74.    your faxes.
  75. >
  76. ##include=C:\BITFAX\SEND\SIGNATUR.PCX
  77. John Smith, PhD.
  78.  
  79. <*
  80.    Now that we have composed the letter, save it to a file, make 384K of
  81.    memory available, and run BITFAX with instructions to fax this file to
  82.    the number FAX_NO.
  83.  
  84.    *TIP* You may also attach other files to the BITFAX command line by simply
  85.    preceding the file name with a "-F" as in: "-Fc:\brochure.bfx". Read your
  86.    BITFAX documentation to see what other things you can do.
  87.  
  88.    BITFAX will save all transmit activity to the file BITFAXTX.LOG. When BITFAX
  89.    is finished, read this file and save the last log entry to a memory variable
  90.    TXLOG. Save this log to the memo field NOTES, along with information of
  91.    what has been sent out and to whom it was addressed to.
  92.  
  93.    If the fax was successfully transmitted (the TXLOG will have an "OK" at
  94.    position 55), then put today's date in the field LAST_FAX.
  95. >
  96. <
  97.   WRITE ("C:\BITFAX\SEND\FAX.TXT"),
  98.   RUN   ("C:\BITFAX\BITFAX -FC:\BITFAX\SEND\FAX.TXT -P" + STRTRAN(FAX_NO," "), 384),
  99.  
  100.   TXLOG := TRIM (STUFF (RIGHT (MEMOREAD("C:\BITFAX\BITFAXTX.LOG"), 90), 40, 14, "")),
  101.   PUT ("NOTES", NOTES + "■ " +DTOC( DATE() )+ " FAX to: " +_To+ ", brochure rev 1.21"+_LF+"  "+TXLOG+_LF),
  102.   PUT ("STATUS", SUBSTR(TXLOG, 55)),
  103.   IF (SUBSTR(TXLOG, 55, 2)=="OK", PUT ("LAST_FAX", DATE()), NIL)
  104. >
  105.  
  106.