Skip to main content
Inspiring
September 26, 2012
Question

What's the ExtendScript command for updating a FrameMaker book?

  • September 26, 2012
  • 4 replies
  • 4013 views

I have some scripts adapted from the FM_Outputs_CondText.jsx sample in FM10, but I just noticed today that the book is not getting updated. Seems like I need something in between these two commands:

FileSource = OpenBook(InputFile);

SavePdf(FileSource,InputFile.replace(/\.book$/i,"") + OutPutFiles[output_no]);

This topic has been closed for replies.

4 replies

Inspiring
September 28, 2012

I have a sample project if anyone wants to look at it.

4everJang
Legend
September 29, 2012

Hi,

If you can zip the sample project and script(s) and send them to jang at jang dot nl I can certainly have a look. It might not be immediately due to lots of paid work on my desk right now, but then it might turn out to be simpler than expected.

Ciao

Jang

4everJang
Legend
October 3, 2012

Robert,

What's happening? Did you solve the problem yet? If so, let us know what the solution was. If not, send me the files and I will take a look.

Ciao

Jang

4everJang
Legend
September 27, 2012

Have you tried it with all the chapter files in the book already open? If a file cannot be automatically opened because some error is blocking it, that might cause the UpdateBook to fail.

Inspiring
September 27, 2012

Yes, actually I left out the command that opens the .fm files:

FileSource = OpenBook(InputFile);

OpenBookFiles(FileSource)

UpdateBook(FileSource)

SavePdf(FileSource,InputFile.replace(/\.book$/i,"") + OutPutFiles[output_no]);

CloseAll()

4everJang
Legend
September 27, 2012

Can you post the full text of the (relevant portion of) the script here ?

Inspiring
September 27, 2012

I no longer have any conditions that are different between PDF and online help, so I no longer need such a complicated script. All I really need is:

open book

update book

save as pdf

close book

September 27, 2012

rlauriston,

You can use the following code snippet to update the book:

int status = Book.UpdateBook(updateParams:PropVals , updateReturnParams:PropVals)

Regards,

FrameGurus

Inspiring
September 27, 2012

That breaks the script, nothing happens at all.

UpdateBook(FileSource) or UpdateAll() cause script processing to halt.

Participating Frequently
December 1, 2016

Hm, maybe the following function snippet I've found elsewhere can close the gap.

function OpenBookFiles(bname)

    var book = bname;

.

. existing code in that function

.

    var props = GetUpdateBookDefaultParams();

    var index = GetPropIndex(props, Constants.FS_ShowBookErrorLog);

    props[index].propVal.ival = true;   // is usually false for scripts, but I like to see if there are erors

    var returnp = new PropVals();

    book.UpdateBook(props, returnp);

}