5 Replies Latest reply: Aug 5, 2012 12:05 AM by Trevorׅ RSS

    Flag master page items overrides?

    Eugene Tyson CommunityMVP

      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?

        • 1. Re: Flag master page items overrides?
          Trevorׅ Community Member

          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

          • 2. Re: Flag master page items overrides?
            Eugene Tyson CommunityMVP

            Thanks for that - unfortunately it won't jump to the pages it's on - making it a bit of a manual process.

             

            I've been in contact with another scripter and he will be posting a script that allows this.

             

            Thanks for the help though

            • 3. Re: Flag master page items overrides?
              Marijan Tompa [tomaxxi] MeganK

              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

              • 4. Re: Flag master page items overrides?
                Trevorׅ Community Member

                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().overriddenMasterPageItem) 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

                • 5. Re: Flag master page items overrides?
                  Trevorׅ Community Member

                  Just making sure everyone got the script edit