Copy link to clipboard
Copied
Hi all,
I have a script that iterates through a book and saves each FM file it finds as an RTF file; however, it takes 10+ sec for the doc.Save() call to complete, which seems like a lot. Just wondering if anyone else has had this problem with saving to RTF? Any insight is greatly appreciated.
The function:
function saveAsRtf(doc)
{
var path = doc.Name;
var saveParams = GetSaveDefaultParams();
var retParams = new PropVals();
var index;
index = GetPropIndex(saveParams, Constants.FS_FileType);
saveParams[index].propVal.ival = Constants.FV_SaveFmtFilter;
index = GetPropIndex(saveParams, Constants.FS_SaveFileTypeHint);
saveParams[index].propVal.sval = "0001ADBIRTF Microsoft RTF1.6";
path = path.replace(/\.[^\.]+$/, ".rtf");
doc.Save(path, saveParams, retParams);
return;
}
- Carl
Copy link to clipboard
Copied
Hi Carl, I would imagine that it may take this long if you just did a File > Save As > RTF. You should try a few of them "by hand" and see how long it takes. The script is not going to send the file through the export filter any faster, but obviously it is more convenient. -Rick
Copy link to clipboard
Copied
Thanks for the reply Rick. I tried that and it does seem like FM is able to save as RTF a bit faster, although not by much.
Copy link to clipboard
Copied
Your import hint doesn't look quite right. I think it should be
saveParams[index].propVal.sval = "0001ADBIRTF ";
I think they are supposed to be 8 characters. I don't know if would make a difference in the speed.
Copy link to clipboard
Copied
It seems that either can be used, with no difference in speed (as far as I can tell, anyways).