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

Master page item override

Contributor ,
Apr 02, 2018 Apr 02, 2018

Copy link to clipboard

Copied

Hi,

     When i used the below code to override master page items, textframe gets override but the position of the textframe gets changed.

     I need to override the textframe without changing the position of the textframe (master page items).  When we do that in manual there is no change in their position but when do that using code its getting change.  I dont know the reason.

     Why its getting change?? How to do that without changing the position???

Before.png

After.png

Code :

overrideMaster()

function overrideMaster()

{

    var allPgs = app.activeDocument.pages;

    for(var pCnt = 0; pCnt < allPgs.length; pCnt++)

    {

        var pg = allPgs[pCnt];

        var masItms = pg.masterPageItems;

        for(var miCnt = masItms.length-1;miCnt >= 0;miCnt--){

            //try{

                masItms[miCnt].override(pg);

            //}catch(e){}

        }//for

    }

  

}//fun

TOPICS
Scripting

Views

1.3K

Translate

Translate

Report

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
Advocate ,
Apr 02, 2018 Apr 02, 2018

Copy link to clipboard

Copied

Be more specific what exactly you want to do?

Your question is a bit unclear!

Votes

Translate

Translate

Report

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
Contributor ,
Apr 03, 2018 Apr 03, 2018

Copy link to clipboard

Copied

I want to do override master page items of pages. When doing this, textframe position is get changed.  But when we do it manually its not changing.

     Without changing the position how to override the master page items?? Pls see screenshot... I have placed before and after of the process... Using code....

Votes

Translate

Translate

Report

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
Community Expert ,
Apr 03, 2018 Apr 03, 2018

Copy link to clipboard

Copied

Hi Sudha,

could be a bug. To work around this you could move the overridden page items to their original places.

I think, we already discussed this bug here in the forums. So search the InDesign Scripting forum.

Regards,
Uwe

Votes

Translate

Translate

Report

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
Community Expert ,
Apr 03, 2018 Apr 03, 2018

Copy link to clipboard

Copied

Also see into the menu action for overriding master page items:

Indiscripts :: InDesign Scripting Forum Roundup #4

Ah, and finally found this:

Override elements by script problems

( Forum search is very lazy today… )

Regards,
Uwe

Votes

Translate

Translate

Report

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
Contributor ,
Apr 03, 2018 Apr 03, 2018

Copy link to clipboard

Copied

Hi,

     Thank you for the links...

     I searched in forum but i got the same kind of code which i used..

  

     I have used the menu action for all pages of document.  Now position is not change but its get overset if the near by objects have wrap option so its get overset.

     Actually i thought to capture the object after overridden and clear the overset but override method overrides the  master page item and return it as new object.  so i couldnot able to capture the overridden object and can't proceed that.

     How to clear overset of the overridden object when it nearby objects have wrap??

     Screen Shot 2018-04-04 at 8.01.01 AM.png

     Can anyone suggest how to proceed this??

Votes

Translate

Translate

Report

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
Community Expert ,
Apr 05, 2018 Apr 05, 2018

Copy link to clipboard

Copied

Hi Sudha,

regarding moving overridden objects to their original position I gave you a link to a thread that exactly handles this.

In the same thread I suggested some code to correct this:

Re: Override elements by script problems

To solve your other problem with text wrap see into:

textFrame.textFramePreferences.ignoreWrap

Set that to true.

Regards,
Uwe

Votes

Translate

Translate

Report

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
Contributor ,
Apr 05, 2018 Apr 05, 2018

Copy link to clipboard

Copied

LATEST

Hi,

     I had tested the override code for pages using menu active.

     app.menuActions.itemByName('$ID/Override All Master Page Items').invoke();

     I feel it was working fine but the textframe got overset.  I tried to capture those (overriden textframe) to apply text wrap but i could not able to capture.  So finally I set the text wrap to the textframe (master page item) as manual.

     I would be helpful if i capture the textframe or object after overriden master page items...

Votes

Translate

Translate

Report

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