Highlighted

How to save Ditamap as "book xx.0 with fm components" using ExtendScript?

New Here ,
Sep 24, 2018

Copy link to clipboard

Copied

I'm trying to write a ExtendScript Toolkit script to save a diamap file as a "book 11.0 with fm components".  When I do this manually I check the box "Prompt for Dita Val File" and select the appropriate Dita Val File.  In the code I've written so far I can open my dita map and save it as a .book file, but I don't know how to give it the location of the Dita Val File.  Anyone know how to add that to my saveParams?

var sourceDoc = openXmlFile("FilePath to diatmap goes here");

var path = "Output FilePath goes here";

saveToFm(sourceDoc, path);

function openXmlFile(filePath) { 

    var file = File(filePath);

    var fileName = file.fsName;

    var openParams = GetOpenDefaultParams(); 

    var retParams = new PropVals();

   

    var doc = Open(fileName, openParams, retParams);

    return doc; 

function saveToFm(fileObject, savePath) { 

    var saveParams = GetSaveDefaultParams(); 

    var i = GetPropIndex(saveParams, Constants.FS_FileType); 

    saveParams.propVal.ival = Constants.FV_SaveFmtBookWithFm; 

    var saveAsName = savePath; 

    var returnParamsp = new PropVals(); 

    fileObject.Save(saveAsName, saveParams, returnParamsp); 

Adobe Community Professional
Correct answer by frameexpert | Adobe Community Professional

I got this from Adobe, but I haven't tried it.

FS_DitavalFile (type: string)

-Rick

TOPICS
Scripting

Views

444

Likes

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

How to save Ditamap as "book xx.0 with fm components" using ExtendScript?

New Here ,
Sep 24, 2018

Copy link to clipboard

Copied

I'm trying to write a ExtendScript Toolkit script to save a diamap file as a "book 11.0 with fm components".  When I do this manually I check the box "Prompt for Dita Val File" and select the appropriate Dita Val File.  In the code I've written so far I can open my dita map and save it as a .book file, but I don't know how to give it the location of the Dita Val File.  Anyone know how to add that to my saveParams?

var sourceDoc = openXmlFile("FilePath to diatmap goes here");

var path = "Output FilePath goes here";

saveToFm(sourceDoc, path);

function openXmlFile(filePath) { 

    var file = File(filePath);

    var fileName = file.fsName;

    var openParams = GetOpenDefaultParams(); 

    var retParams = new PropVals();

   

    var doc = Open(fileName, openParams, retParams);

    return doc; 

function saveToFm(fileObject, savePath) { 

    var saveParams = GetSaveDefaultParams(); 

    var i = GetPropIndex(saveParams, Constants.FS_FileType); 

    saveParams.propVal.ival = Constants.FV_SaveFmtBookWithFm; 

    var saveAsName = savePath; 

    var returnParamsp = new PropVals(); 

    fileObject.Save(saveAsName, saveParams, returnParamsp); 

Adobe Community Professional
Correct answer by frameexpert | Adobe Community Professional

I got this from Adobe, but I haven't tried it.

FS_DitavalFile (type: string)

-Rick

TOPICS
Scripting

Views

445

Likes

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
Sep 24, 2018 0
Adobe Community Professional ,
Sep 24, 2018

Copy link to clipboard

Copied

I got this from Adobe, but I haven't tried it.

FS_DitavalFile (type: string)

-Rick

Likes

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
Reply
Loading...
Sep 24, 2018 0
New Here ,
Sep 24, 2018

Copy link to clipboard

Copied

Thank you!  I added these lines to my saveToFm function and it works!

var i = GetPropIndex(saveParams, Constants.FS_DitavalFile); 

saveParams.propVal.sval = "FilePath to Dita Val File goes here"

Likes

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
Reply
Loading...
Sep 24, 2018 0
Adobe Community Professional ,
Sep 24, 2018

Copy link to clipboard

Copied

Fantastic! Please mark my answer as Correct. Thanks.

Likes

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
Reply
Loading...
Sep 24, 2018 0