doc.Save() taking forever to complete

New Here ,
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

601

Likes

Translate

Translate

Report

Report
Reply
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Adobe Community Professional ,
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

Likes

Translate

Translate

Report

Report
Reply
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
New Here ,
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.

Likes

Translate

Translate

Report

Report
Reply
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Adobe Community Professional ,
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.

Likes

Translate

Translate

Report

Report
Reply
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
carlm80163462 AUTHOR LATEST
New Here ,
Oct 28, 2015

Copy link to clipboard

Copied

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

Likes

Translate

Translate

Report

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