Skip to main content
This topic has been closed for replies.
Correct answer Manan Joshi

Hi Frederico,

Try the following, change the string C-Master to the name of the master page that you want to apply.

var tf = app.documents[0].pages.everyItem().textFrames.everyItem().getElements()

for(var i = 0; i < tf.length; i++)

{

    if(tf.contents == "")

          tf.parentPage.appliedMaster = app.documents[0].masterSpreads.itemByName("C-Master")

}

-Manan

3 replies

New Participant
May 21, 2019

Thanls a lot! That worked great!

Inspiring
May 21, 2019

Hi,

     Assign some label to that textframe to identify and check then contents of that textframe and apply master page.

Manan JoshiCorrect answer
Community Expert
May 20, 2019

Hi Frederico,

Try the following, change the string C-Master to the name of the master page that you want to apply.

var tf = app.documents[0].pages.everyItem().textFrames.everyItem().getElements()

for(var i = 0; i < tf.length; i++)

{

    if(tf.contents == "")

          tf.parentPage.appliedMaster = app.documents[0].masterSpreads.itemByName("C-Master")

}

-Manan