; *** Portable Document Mail Script for Appraise-It ; Generates an Adobe Acrobat PDF of the Appraisal and ; places it into a mail message for transmission. ; ; 04/12/96 ; Software for Real Estate Professionals ; Author : R. Robison FUNCTION StripPath$( String$ ) pos% = instr%( 1, String$, "\\" ) while ( pos% > 0 ) lastslash% = pos% pos% = instr%( pos%+1, String$, "\\" ) wend num% = len( String$ ) - lastslash% StripPath$ = UCASE$(right$( String$, num% )) END FUNCTION ; *** Prepare PDF filename rep$ = constant$( "ReportName" ) i% = instr%( 1, rep$, "." ) newrep$ = left$( rep$, i% ) + "PDF" Status( "Select pages to include in the portable document and choose 'Print'" ) ; Name the initialization file for PDFWriter, wd$ = WinDir$() ; ...for Win9X and ME: pdfIni$ = wd$ + "\\win.ini" ; ... or for WinNT and Win2K: ; pdfIni$ = wd$ + "\\system32\\spool\\drivers\\w32x86\\2\\__pdf.ini" WritePPS "Acrobat PDFWriter","PDFFileName", newrep$, pdfini$ WritePPS "Acrobat PDFWriter","bDocInfo", "0", pdfini$ WritePPS "Acrobat PDFWriter","szTitle", cell("offscrn","Address"), pdfini$ WritePPS "Acrobat PDFWriter","szAuthor", cell("offscrn","AprName"), pdfini$ WritePPS "Acrobat PDFWriter","szCreator", cell("offscrn","Company"), pdfini$ WritePPS "Acrobat PDFWriter","szProducer", "Appraise-It, SFREP", pdfini$ ; *** The second paramater to PrintReport specifies the print driver. It attempts to pick a print driver ; based on PORT, driver name, or driver description pattern match. Since the PDF driver varies from platform ; to platform, I use a pattern match on the driver description. At the time of this script writing, it works ; for all windows platforms. This parameter could be LPT1 or PDFWRITR as well. PrintReport "", "Acrobat PDF" ; *** Now clear out all of those Acrobat default settings so as to not conflict with other applications WritePPS "Acrobat PDFWriter","PDFFileName", "", pdfini$ WritePPS "Acrobat PDFWriter","bDocInfo", "", pdfini$ WritePPS "Acrobat PDFWriter","szTitle", "", pdfini$ WritePPS "Acrobat PDFWriter","szAuthor", "", pdfini$ WritePPS "Acrobat PDFWriter","szCreator", "", pdfini$ WritePPS "Acrobat PDFWriter","szProducer", "", pdfini$ ; *** Attach PDF to MAPI mail message if FileExists%( newrep$ ) > 0 then Register "MAPI.DLL", "MAPISendDocuments", "USSSU" MAPISendDocuments 0, ";", newrep$, StripPath$(newrep$), 0 result% = DeleteFile%( newrep$ ) end if