Skip to main content
Known Participant
October 27, 2015
Question

doc.Save() taking forever to complete

  • October 27, 2015
  • 1 reply
  • 844 views

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

This topic has been closed for replies.

1 reply

frameexpert
Community Expert
Community Expert
October 27, 2015

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

www.frameexpert.com
Known Participant
October 27, 2015

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.

frameexpert
Community Expert
Community Expert
October 28, 2015

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.

www.frameexpert.com