>*-* Author: Terence Tam (mailto:justok@iname.com) >*-* FileName: CleanFrx.prg >*-* Usage: CleanFrx() will automatic clean ALL frx in currectory dir. >*-* CleanFrx("???INV.frx") will clean matched condition frx files. >*-* CleanFrx("*.lbx") will clean ALL Labels! > >LPARAMETERS pFileFilter > >IF PCOUNT() = 0 > LFileFilter = "*.frx" >ELSE > LFileFilter = pFileFilter >ENDIF > >nFileCount = ADIR(frxFile, LFileFilter) > >IF nFileCount = 0 > MESSAGEBOX("No .Frx File is found at "+CURDIR(),0+32,"What a Pity!") > RETURN .F. && Why .f. - on purpose ? >ENDIF > >FixedFileList = "" >FOR iCount = 1 to nFileCount > USE frxFile[iCount,1] && Dirinfo is two dimensional > FixedFileList = FixedFileList + frxFile[iCount,1] + Chr(13) > BLANK fields expr, tag, tag2 && Blank to remove printer driver info > WAIT "Cleaning "+ frxFile[iCount,1] Window NoWait >** For some special reports... >** REPLACE expr with "PAPERSIZE=256" + CHR(13) + "PAPERLENGTH=2750" + CHR(13) + "PAPERWIDTH=2100" + CHR(13) > > IF "PLAN" $ frxFile[iCount,1] > * Plan.frx need Orientation=1 means Print in LandScape > REPLACE expr with "ORIENTATION=1" > ENDIF >*!* replace All NoRepeat With .f. for !IsBlank(NoRepeat) && Use Once only > USE && As Barbara pointed out always the first record >ENDFOR > >CLEARMSG = "The Following Files in " + SYS(5) +CURDIR() + " : " + CHR(13) + FixedFileList + " have been Fixed, Compile Execute?" > >IF LEN(CLEARMSG) < 255 > IF MESSAGEBOX("The Following Files in " + SYS(5) +CURDIR() + " : " + CHR(13) + FixedFileList + " have been Fixed, Compile Execute?", 4 + 64, "CleanFrx Function") = 7 > RETURN > ENDIF >ELSE > WW(CLEARMSG) >ENDIF >KEYBOARD '{ENTER}' > >SET SAFETY OFF >Delete FILE *.ERR >Delete FILE *.BAK >Delete FILE *.TMP >Delete FILE *.TBK > >*SET SAFETY ON >WAIT WINDOW "All Done!!" TIMEOUT 3 > >