Frame maker 13 scripting question
Hello,
I am using the following script to convert fm/mif files in a folder to PDF. The script fails in 2 places. I am using FM 13.
saveMultFilesTpPDF();
function saveMultFilesTpPDF() {
var stop = false;
while( stop==false ) {
// Wait for 20.000 ms
//$.sleep(20000);
var fld = new Folder("c:/incoming");
var filesInFld = fld.getFiles("*.fm");
for(var f=0; f < filesInFld.length; f++) {
// process the individual file
$.writeln(filesInFld
saveDocToPdf (filesInFld
}
// Exit the loop after 19:00
var time = new Date();
if( time.getHours() > 19 ) stop = true;
}
}
function saveDocToPdf (doc, jobOption) {
var params, returnParams, saveName, i;
// Set the PDF Job Option for the document.
doc.PDFJobOption = jobOption;
// Replace the .fm extension with .pdf.
// Exceution fails on line below with "undefined is not an object"
saveName = doc.Name.replace (/\.[^\.\\]+$/,".pdf");
// Get the save parameters and set the file type to PDF>
params = GetSaveDefaultParams();
returnParams = new PropVals();
i = GetPropIndex (params, Constants.FS_FileType);
params.propVal.ival =Constants.FV_SaveFmtPdf;
// Call the document's Save method. The script fails with
// Exceution fails on line below with "is not a function"
doc.Save(saveName, params, returnParams);
}
