Skip to main content
Inspiring
Sep 26, 2012 8:14 PM UTC
Question

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

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 is closed to new replies. Start a new post to keep the conversation going.

12 replies

Inspiring
Sep 28, 2012 11:21 PM UTC

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

Translate
4everJang
Legend
Sep 29, 2012 7:41 AM UTC

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

Translate
4everJang
Legend
Oct 3, 2012 12:20 PM UTC

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

Translate
4everJang
Legend
Sep 27, 2012 6:19 PM UTC

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.

Translate
Inspiring
Sep 27, 2012 6:27 PM UTC

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()

Translate
4everJang
Legend
Sep 27, 2012 6:32 PM UTC

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

Translate
Inspiring
Sep 27, 2012 6:13 PM UTC

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

Translate
Sep 27, 2012 5:56 PM UTC

rlauriston,

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

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

Regards,

FrameGurus

Translate
Inspiring
Sep 27, 2012 6:11 PM UTC

That breaks the script, nothing happens at all.

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

Translate
Participating Frequently
Dec 1, 2016 12:50 PM UTC

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);

}

Translate