home *** CD-ROM | disk | FTP | other *** search
- <*
- FAX.MRG - Sample merge print file for CONTACT database.
- ~~~~~~~
- This is an example of how you may feed data to, and call external
- programs from within MyBASE while merge printing.
-
- Using this program you may merge and fax truly personalized documents to
- multiple destinations. This merge program first creates the document
- and then calls an external program (BITFAX for DOS) to fax the document
- via a fax/modem. Although in this example BITFAX is used for transmitting,
- other fax software may work equally as well.
-
- NOTE: Statements below which begin with the hash mark (#) are only
- evaluated ONCE! However, since the results of each of these functions is
- assigned to a memory variable, they may be used later without needing
- to re-evaluate the entire function (much faster).
-
- ** Note also that code blocks always need to be pre-processed!
-
- >
- <# _Date := CMONTH(DATE()) +" "+ ALLTRIM(STR(DAY(DATE()))) +","+ STR(YEAR(DATE())) >
- <# _To := "" > <* create a memory variable to hold the name of
- the person being faxed >
- <# _DoNothing := {|| NIL} > <* this is a code block >
- <# _SkipThis := {|| .not. FAX .or. EMPTY( FAX_NO )} > <* ...and so is this >
- <*
-
- The following statement uses the code blocks which have been defined above
- to skip all records which do not have a fax number "EMPTY( FAX_NO )" or
- which have been flagged as 'do not fax' ".not. FAX"
-
- >
- < DBEVAL (_DoNothing,, _SkipThis,, .T.) >
-
-
-
- John Smith
- XYZ Company Inc.
- 101 Street Avenue
- Anywhere, Anystate
- 12345
-
- Tel. (999) 555-1212
-
-
-
- < _Date >
-
- < TRIMLINES (
- TRIM (TRIM (SAL) +" "+ FIRST_NAME) +" "+ LAST_NAME + _LF +
- TITLE + _LF +
- DEPARTMENT+ _LF +
- COMPANY + _LF +
- ADDRESS_1 + _LF +
- ADDRESS_2 + _LF +
- TRIM (CITY)+ ", " + STATE + _LF +
- ZIP_CODE + _LF )
- >
-
- Dear < _To := IF( EMPTY(LAST_NAME), "Sir/Madam", TRIM (TRIM (SAL)+" "+LAST_NAME)) >,
-
- *******************
-
- TEXT
-
- *******************
-
-
- Yours very truly,
- <*
- The next line is a BITFAX command which will pull-in an external file
- into this document. In this case a PCX signature will be inserted in
- this spot. You can use the same idea to add a company logo to the top of
- your faxes.
- >
- ##include=C:\BITFAX\SEND\SIGNATUR.PCX
- John Smith, PhD.
-
- <*
- Now that we have composed the letter, save it to a file, make 384K of
- memory available, and run BITFAX with instructions to fax this file to
- the number FAX_NO.
-
- *TIP* You may also attach other files to the BITFAX command line by simply
- preceding the file name with a "-F" as in: "-Fc:\brochure.bfx". Read your
- BITFAX documentation to see what other things you can do.
-
- BITFAX will save all transmit activity to the file BITFAXTX.LOG. When BITFAX
- is finished, read this file and save the last log entry to a memory variable
- TXLOG. Save this log to the memo field NOTES, along with information of
- what has been sent out and to whom it was addressed to.
-
- If the fax was successfully transmitted (the TXLOG will have an "OK" at
- position 55), then put today's date in the field LAST_FAX.
- >
- <
- WRITE ("C:\BITFAX\SEND\FAX.TXT"),
- RUN ("C:\BITFAX\BITFAX -FC:\BITFAX\SEND\FAX.TXT -P" + STRTRAN(FAX_NO," "), 384),
-
- TXLOG := TRIM (STUFF (RIGHT (MEMOREAD("C:\BITFAX\BITFAXTX.LOG"), 90), 40, 14, "")),
- PUT ("NOTES", NOTES + "■ " +DTOC( DATE() )+ " FAX to: " +_To+ ", brochure rev 1.21"+_LF+" "+TXLOG+_LF),
- PUT ("STATUS", SUBSTR(TXLOG, 55)),
- IF (SUBSTR(TXLOG, 55, 2)=="OK", PUT ("LAST_FAX", DATE()), NIL)
- >
-
-