3 Replies Latest reply on Sep 15, 2015 11:59 PM by hamdifem

    find text remove textFrame

    hamdifem Level 1

      in the "TEST" is written finding text frames

      I want to remove textframe

       

      var myDoc = app.activeDocument;    
      var myFrame = myDoc.allPageItems;
      for(var i=0;i<myFrame.length;i++){
      if(myFrame[i] instanceof TextFrame){
      if(myFrame[i].indexOf("TEST")){
      myFrame.remove();
      }
      }
      
        • 1. Re: find text remove textFrame
          Ronald63 Level 4

          Hi,

           

          Where are writing "TEST" ? It is the content or label  of the frame ?


          Regards

          • 2. Re: find text remove textFrame
            Chinnadk Level 4

            Is this you need?

             

            var myDoc = app.activeDocument;      
            var myFrame = myDoc.allPageItems;  
            for(var i=0;i<myFrame.length;i++)
            {
                    if(myFrame[i] instanceof TextFrame)
                    {  
                            app.findTextPreferences = app.changeTextPreferences = null;
                            app.findTextPreferences.findWhat = "TEST";
                            var found = myFrame[i].findText();
                            if(found.length > 0)
                            {  
                                    myFrame[i].remove();  
                                }
                        }  
                }  
            
            • 3. Re: find text remove textFrame
              hamdifem Level 1

              In the text frame

              İf in the text frame any paragraph "TEST" when. Remove this text frame