Skip navigation
Currently Being Moderated

Flag master page items overrides?

Jul 31, 2012 7:02 AM

Say for example you have an item on a master page, and you make a change to that item - then on page 521 or something that item was overridden at some stage and is no longer linked to the master.

 

Any script out there to do this?

 
Replies
  • Currently Being Moderated
    Aug 2, 2012 5:38 AM   in reply to Eugene Tyson

    This will turn them all yellow

    myPageItems=app.documents[0].pages.everyItem().pageItems.everyItem();

    if (myPageItems.overriddenMasterPageItem !=null) myPageItems.fillColor="C=0 M=0 Y=100 K=0"

    Trevor

     
    |
    Mark as:
  • Currently Being Moderated
    Aug 3, 2012 4:55 AM   in reply to Eugene Tyson

    I've wrote short script to tag overridden master page items with custom XML tag.

    It also works with anchored items, and have statistics at the end of the script.

     

    Script can be found here:

    tomaxxiMARK-UP 1.0d on http://tomaxxi.com/downloads

     

    --

    Marijan (tomaxxi)

    http://tomaxxi.com

     
    |
    Mark as:
  • Currently Being Moderated
    Aug 5, 2012 12:04 AM   in reply to Marijan Tompa

    Eugene, Marijan, Everybody

     

    Nice Marijan,

     

    The below script can either be added to the end of your script or run independently.

     

    It allows one to jump to the overridden master page items and make a report of all of them.

     

    I think you should add a button to the SUI to remove the XML markups.

     

    Just one little note on experimenting I came across an overridden master page item that was not "spotted" by our scripts but was by my "Yellow" script above this was because somehow the item was returning null on the (myPageItems[c].overriddenMasterPageItem !=null) test but not null on the (myPageItems.overriddenMasterPageItem !=null) test. Weird!

     

    Unfortunately I deleted the file with this item and couldn't reproduce it.

    alert(app.documents[0].pages.everyItem().pageItems.everyItem().overrid denMasterPageItem) would demonstrate this by returning an extra comma for an item that is an overriddenMasterPageItem but is null.

     

    P.s. you forgot to set a target engine for your palette.

     

    Regards

     

    Trevor

     

    // see http://forums.adobe.com/message/4593688
    #target "indesign"
    #targetengine "Trevor"
    report();
    function report()
    {
    myOverriddendPageItems=[];
    myOverriddendPageItem=[];
    myOverriddendPages=[];
    myDoc=app.documents[0];
    for (p=0; p<myDoc.pages.length; p++)
    {
    myPageItems=myDoc.pages[p].pageItems;
    for (c=0; c<myPageItems.length; c++)
    {
        if (myPageItems[c].overriddenMasterPageItem !=null)
        {
            myPageItems[c].label="Overriden Master Page Item"; // delete this line if  unwanted (if you have allocated script lables to the items)
            itemDetails="Page "+myPageItems[c].parentPage.name+" "+myPageItems[c]+" "+myPageItems[c].index+"\r";
            myOverriddendPageItems.push(itemDetails);
            myOverriddendPageItem.push(myPageItems[c]);        
            myOverriddendPages.push(myPageItems[c].parentPage.id);
        }
    }
    }
    //var w = Window.find ("palette", "Overridden Master Page Items");
    //if (w === null) 
    {
    var w = new Window ("palette", "Overridden Master Page Items", undefined, {resizeable: false});
    var myList = w.add ("listbox", undefined, myOverriddendPageItems, {multiselect: false, });
    myList.maximumSize.height=500;
    var makeReport = w.add ("button", undefined, "Create Report Document");
    myList.onChange = function ()
    {
    //app.activeWindow.activePage=myDoc.pages.itemByID (myOverriddendPages[myList.selection.index]);
    myOverriddendPageItem[myList.selection.index].select();
    }
    makeReport.onClick = function ()
    {
        myReportDoc=app.documents.add();
        setupNewDoc()
    }
    }    
    w.show ();
     
    function setupNewDoc()
    {
    pageBounds=[];
    pageBounds[0]=myReportDoc.pages.item(0).bounds;
    topMargin=myReportDoc.pages.item(0).marginPreferences.top;
    leftMargin=myReportDoc.pages.item(0).marginPreferences.left;
    rightMargin=myReportDoc.pages.item(0).marginPreferences.right;
    bottomMargin=myReportDoc.pages.item(0).marginPreferences.bottom;
    frameBounds=[];
    frameBounds[0]=[0,0,0,0]
    frameBounds[0][0]=topMargin+pageBounds[0][0];
    frameBounds[0][2]=pageBounds[0][2]-bottomMargin;
    frameBounds[0][1]=leftMargin+pageBounds[0][1]; 
    frameBounds[0][3]=pageBounds[0][3]-rightMargin;
    myTextFrame=myReportDoc.pages[0].textFrames.add({geometricBounds: frameBounds[0]});
    myTextFrame.contents+=myList.items;
    while (myTextFrame.overflows) {addPage(myTextFrame)
        }
     
     
    function addPage(prevTextFrame)
    {
        myPage = myReportDoc.pages.add();
        myTextFrame = myPage.textFrames.add({geometricBounds: frameBounds[0]});
        myTextFrame.previousTextFrame = prevTextFrame;
    }
    }
    }
     
    

     

    Message was edited by: ~ Trevor ~ Edited script to avoid problems in event of a large number of overridden master page items

     
    |
    Mark as:
  • Currently Being Moderated
    Aug 5, 2012 12:05 AM   in reply to Trevorׅ

    Just making sure everyone got the script edit

     
    |
    Mark as:

More Like This

  • Retrieving data ...

Bookmarked By (0)

Answers + Points = Status

  • 10 points awarded for Correct Answers
  • 5 points awarded for Helpful Answers
  • 10,000+ points
  • 1,001-10,000 points
  • 501-1,000 points
  • 5-500 points