Skip to main content
Participating Frequently
February 12, 2023
Answered

Apply master to other masters

  • February 12, 2023
  • 1 reply
  • 490 views

Is there a way to apply the master page A-Project to 1-Project, 2-Project, 3-Project...etc all at once? I searched everywhere but couldn't find a solution.

 

This topic has been closed for replies.
Correct answer m1b

Hi @Rachel28371239g14w, here's a quick little script:

/*
 * Apply Master to Project Masters
 * @discussion https://community.adobe.com/t5/indesign-discussions/apply-master-to-other-masters/m-p/13573264
 */
function main() {

    var doc = app.activeDocument,
        matchProjectPageNames = /^\d+-Project$/,
        masterPage = doc.masterSpreads.itemByName('A-Project');

    if (!masterPage.isValid) {
        alert('Master page is not valid.');
        return;
    }

    for (var i = 0; i < doc.masterSpreads.length; i++)
        if (matchProjectPageNames.test(doc.masterSpreads[i].name))
            doc.masterSpreads[i].appliedMaster = masterPage;

} // end main

app.doScript(main, ScriptLanguage.JAVASCRIPT, undefined, UndoModes.ENTIRE_SCRIPT, 'Apply Master to Project Masters');

- Mark

1 reply

m1b
Community Expert
m1bCommunity ExpertCorrect answer
Community Expert
February 12, 2023

Hi @Rachel28371239g14w, here's a quick little script:

/*
 * Apply Master to Project Masters
 * @discussion https://community.adobe.com/t5/indesign-discussions/apply-master-to-other-masters/m-p/13573264
 */
function main() {

    var doc = app.activeDocument,
        matchProjectPageNames = /^\d+-Project$/,
        masterPage = doc.masterSpreads.itemByName('A-Project');

    if (!masterPage.isValid) {
        alert('Master page is not valid.');
        return;
    }

    for (var i = 0; i < doc.masterSpreads.length; i++)
        if (matchProjectPageNames.test(doc.masterSpreads[i].name))
            doc.masterSpreads[i].appliedMaster = masterPage;

} // end main

app.doScript(main, ScriptLanguage.JAVASCRIPT, undefined, UndoModes.ENTIRE_SCRIPT, 'Apply Master to Project Masters');

- Mark

Participating Frequently
February 12, 2023

Amazing. Thank you loads!

m1b
Community Expert
Community Expert
February 12, 2023

You're welcome!