Skip to main content
rombanks
Inspiring
December 26, 2013
Answered

Extendscript that runs "Apply Master Pages"

  • December 26, 2013
  • 1 reply
  • 3334 views

Hello Framers,

In the extendscipt toolkit data browser, I don't see an option to apply master pages to a document (as in Format-->Page Layout--> Apply Master Pages...).

Shouldn't this be some kind of a function? Am I missing something?

Thank you in advance!

This topic has been closed for replies.
Correct answer 4everJang

Hi Jang, Rick,

I appreciate your responses, guys!

I tried running the FCodes command in the Exscript tool, but only got the "Result 0" message. If Jang said this command works, apparently I ran it in a wrong way.

I hope you will enlighten me how to do that.

Happy Christmas to you!

My best wishes,

Roman


Hi Roman,

The return code for Fcodes is always 0, and there is no FA_errno either. This means you just have to assume that the command really worked, or find a way to check the document(s) after running the ApplyMasterPages command to make sure that the result is what you want.

To see whether it really works, create a document with a couple of pages, define the rules in the StructMasterPageMaps (for structured docs) or UnStructMasterPageMaps table, then run the Apply Master Pages command via the menu and see what the document looks like. Then manually overrule one or more body pages in the document, then run the ExtendScript and check the result.

Good luck

Jang

1 reply

4everJang
Brainiac
December 26, 2013

I have answered this same question last week on the FrameScript forum. In that scripting product, there is an option to execute any FrameMaker command as long as you can find the command name. Looking for the command in config files I noticed that the command is not there. It is probably added to the menu via MasterPages.DLL which would imply that it is implemented as a FrameMaker client. This means you should be able to call the command via CallClient, but you would have to know the client name and the command to use. If I find out more, I will post a new reply here. Or maybe someone from Adobe can enlighten us on this point.

Kind regards

Jang

rombanks
rombanksAuthor
Inspiring
December 26, 2013

Hi Jang,

Thank you for your prompt response! I've already tried using CallClient(), but for some reason, I get an error saying that app.CallClient() is not a function. I doubt if Adobe guys respond. Our only hope is the Adobe community experts like you.

My best wishes,

Roman

4everJang
4everJangCorrect answer
Brainiac
December 26, 2013

Hi Jang, Rick,

I appreciate your responses, guys!

I tried running the FCodes command in the Exscript tool, but only got the "Result 0" message. If Jang said this command works, apparently I ran it in a wrong way.

I hope you will enlighten me how to do that.

Happy Christmas to you!

My best wishes,

Roman


Hi Roman,

The return code for Fcodes is always 0, and there is no FA_errno either. This means you just have to assume that the command really worked, or find a way to check the document(s) after running the ApplyMasterPages command to make sure that the result is what you want.

To see whether it really works, create a document with a couple of pages, define the rules in the StructMasterPageMaps (for structured docs) or UnStructMasterPageMaps table, then run the Apply Master Pages command via the menu and see what the document looks like. Then manually overrule one or more body pages in the document, then run the ExtendScript and check the result.

Good luck

Jang