2 Replies Latest reply on Feb 26, 2013 4:38 AM by shilpa25

    delete textFrames which has same contents

    shilpa25 Level 1

      Hi Forum,

       

      I have this script, this will remove the all the textFrame which has contents ©LW..

      there are more than one textFrames' which has ©LW contents.

       

      I want to retain one text frame which has ©LW contents in it.and delete all others textFrame which has ©LW contents.

       

       

      var myDoc = app.activeDocument;

      var myPageItems = myDoc.allPageItems;

       

      for (var i =0; i<myPageItems.length; i++){

          app.select(myPageItems[i]);

          var mySel = app.selection[0];

      //var Cont = app.selection.contents;

      try{

              mySel.locked=false;

              }catch(e){};

             

              if(mySel.constructor.name == "TextFrame"){

                  if(mySel.contents == "©LW"){

                      try{

                         if (mySel.contents >1) {

                          mySel.remove();

                          }

                         

                          }catch(e){};

                          }

                      app.selection = null;

                      }

                  }

       

      thanks..