Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

InDesign JavaScript override master page item

New Here ,
Sep 17, 2015 Sep 17, 2015

Hi guys

I can't get a Master page item override working.

In the code below what should I put as destinationPage?

Currently, I keep getting an error message "Invalid object for this request"

var myDoc = app.activeDocument;

var myPages=myDoc.pages;

var myItems = myDoc.pages[0].appliedMaster.allPageItems;

        for (y=0; y<myItems.length; y++){

            if(myItems instanceof TextBox){

                    myItems.override(myPages[0]); //This bit doesn't work. What do I put here as destinationPage?

               }

              

            }

Thanks

TOPICS
Scripting
2.2K
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 1 Correct answer

Enthusiast , Sep 17, 2015 Sep 17, 2015

Hi,

Try this ...

var myDoc = app.activeDocument;

var myItems = myDoc.pages[0].appliedMaster.pageItems.everyItem().getElements();

for(var y=0;y<myItems.length;y++){

    if(myItems instanceof TextFrame){

        try{myItems.override(myDoc.pages[0]);}

        catch(e){}

    }

}

Translate
Enthusiast ,
Sep 17, 2015 Sep 17, 2015

Hi,

Try this ...

var myDoc = app.activeDocument;

var myItems = myDoc.pages[0].appliedMaster.pageItems.everyItem().getElements();

for(var y=0;y<myItems.length;y++){

    if(myItems instanceof TextFrame){

        try{myItems.override(myDoc.pages[0]);}

        catch(e){}

    }

}

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Sep 17, 2015 Sep 17, 2015
LATEST

It turned out the text frame was in a group, and for that reason it couldn't be detached from the Master.

Thanks a lot for  a prompt response!

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines