Back

If your email is not recognized and you believe it should be, please contact us.

Forum Replies Created

Viewing 1 post (of 1 total)
  • Author
    Posts
  • in reply to: Applying a master based on paragraph style #99448

    I know this is late but it’ll be a good reference for future visitors.

    I believe your question has been answered here: https://forums.adobe.com/thread/1027292

    Just in case the website doesn’t exist in the future, here’s the code:

    var myDocument = app.activeDocument;
    var myParas = myDocument.stories.everyItem().paragraphs.everyItem().getElements();
    var myPage = myDocument.pages;
    for(i=0; i<myParas.length; i++)
    {
        if(myParas[i].appliedParagraphStyle.name == "CT")  
        {
            //Works only in CS5 and later
            myParas[i].parentTextFrames[0].parentPage.appliedMaster = myDocument.masterSpreads.item("B-Master");
            //for CS4 use this
            //myParas[i].parentTextFrames[0].parent.appliedMaster = myDocument.masterSpreads.item("B-Master");
        }
    }
    
Viewing 1 post (of 1 total)