1 Reply Latest reply on Sep 22, 2009 4:42 AM by Harbs.

    I need this script sarch all paragraph styles, groups included...

    Marcos Suárez Level 1

       

      #target indesign;
      
      myDoc = app.documents[0];
      if (myDoc.indexes.length == 0)
        myDoc.indexes.add ();
      app.findGrepPreferences = null;
      app.findGrepPreferences.findWhat = "^.*";
      app.findGrepPreferences.appliedParagraphStyle = myDoc.paragraphStyles.item ('Name');
      myFound = myDoc.findGrep (true);
      for (i = 0; i < myFound.length; i++)
        {
        try
          {
          newTopic = myDoc.indexes[0].topics.add (myFound[i].contents);
          newTopic.pageReferences.add (myFound[i], PageReferenceType.currentPage);
          }
        catch (_){}
        }
        • 1. Re: I need this script sarch all paragraph styles, groups included...
          Harbs. Level 6
          var myName = "Name";
          var myStyle = null;
          var allStyles = myDoc.allParagraphStyles;
          for(var i=0;i<allStyles.length;i++){
            if(allStyles.name == myName){
              myStyle = allStyles[i];
              break;
            }
          }
          if(!myStyle){alert("Style Missing!");exit()}
          
          // continuation of your script
          
          app.findGrepPreferences.appliedParagraphStyle = myStyle;
          //rest of your script
          
          

           

          This assumes you only have one style by that name...

           

          Harbs

          1 person found this helpful