Search code examples
adobe-indesign

InDesign scripting: How to apply sub-master to a master page?


I am new to InDesign Scripting. I am trying to write a script to apply a master page (sub-master) to a master page. I am not able to figure out how to do this.

Can anyone help?


Solution

  • You need to set the property appliedMaster of your masterSpread to another masterSpread.

    So basically something like (this to apply a sub master page to a main master page):

    var doc = app.activeDocument;
    var mainMaster = doc.masterSpreads.item("Name of Main Master");
    var subMaster = doc.masterSpreads.item("Name of Sub Master");
    
    mainMaster.appliedMaster = subMaster;