• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

doc.Save() taking forever to complete

Community Beginner ,
Oct 27, 2015 Oct 27, 2015

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

TOPICS
Scripting

Views

709

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Oct 27, 2015 Oct 27, 2015

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

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Oct 27, 2015 Oct 27, 2015

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.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Oct 27, 2015 Oct 27, 2015

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.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Oct 28, 2015 Oct 28, 2015

Copy link to clipboard

Copied

LATEST

It seems that either can be used, with no difference in speed (as far as I can tell, anyways).

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines