3 Replies Latest reply on Jan 21, 2010 4:49 AM by Kasyan Servetsky

    Release anchored objects

    Patrick Ingelsten

      Try to find a simple and working way to release all anchored objects in a document.

      Anyone have solution?

        • 1. Re: Release anchored objects
          Harbs. Level 6

          Try this:

           

          app.documents[0].stories.everyItem().pageItems.everyItem().anchoredObjectSettings.releaseAnchoredObject();
          
          

          Harbs

          • 2. Re: Release anchored objects
            Kasyan Servetsky Level 5

            This works for graphic anchored objects that have position set to custom.

             

            if(app.documents.length!=0) {
                var ad = app.activeDocument; 
                var pgit = ad.pageItems;
                var pgitlg = pgit.length;
                var objprocessed = 0;
                if(pgitlg !=0)
                {
                    for(i=0; i<pgitlg; i++)
                    {
                        if(pgit[i].getElements()[0].constructor.name == "TextFrame")
                        {
                            var tfg = pgit[i].allGraphics;
                            var tfglg = tfg.length;
                            for(j=0; j<tfglg; j++)
                            {
                                var rec = tfg[j].parent;
                                rec.anchoredObjectSettings.releaseAnchoredObject();
                            }
                        }
                    }
                }
            }