6 Replies Latest reply on Dec 1, 2014 8:01 PM by hasvi

    How to map para style by script

    hasvi Level 1

      Hi

       

      My indesign file has already some Group style, when I try to flow the XML file in Indesign that time same style of paragraph are not mapped with automatically. FYI

      1.png

      Here 'TXT' style is already defined in 'Chapters' Group style (see Part A). After flowing again 'TXT' (see Part B) is coming in without mapping.

      Now I want to map the 'Part B' style with 'Part A' is this possible by script?

        • 1. Re: How to map para style by script
          Sajeev Sridharan Level 4

          Try this,

           

          app.findGrepPreferences = app.changeGrepPreferences = null;
          app.findGrepPreferences.appliedParagraphStyle = "TXT";
          app.changeGrepPreferences.appliedParagraphStyle = app.activeDocument.paragraphStyleGroups.item("Chapters").paragraphStyles.item("TXT"); 
          app.activeDocument.changeGrep();  
          app.findGrepPreferences = app.changeGrepPreferences = null;
          

           

           

          Vandy

          • 2. Re: How to map para style by script
            hasvi Level 1

            Hi vandy

             

            thanks, but if I want to add more style names in existing script means, how can I add the below styles

             

            TXI, H1, H2, EXT...

             

            thanks

            • 3. Re: Re: How to map para style by script
              BEGINNER_X Level 3

              Hi Hasvi,

               

              May the below code is useful, please test in your end.

               

              Thanks vandy...

               

              _mappingStyle("TXT", "Chapters", "TXT")
              _mappingStyle("TXT1", "Chapters", "TXT1")
              
              
              
              function _mappingStyle(findStyle, changeGroup, changeStyle)
              {
                  app.findGrepPreferences = app.changeGrepPreferences = null;  
                  app.findGrepPreferences.appliedParagraphStyle = findStyle;  
                  app.changeGrepPreferences.appliedParagraphStyle = app.activeDocument.paragraphStyleGroups.item(changeGroup).paragraphStyles.item(changeStyle);   
                  app.activeDocument.changeGrep();    
                  app.findGrepPreferences = app.changeGrepPreferences = null;  
                  }
              

               

               

              Regards

              Siraj

              • 4. Re: How to map para style by script
                hasvi Level 1

                Hi

                I have used this code but its showing errors

                _mappingStyle("TXT", "Chapters", "Chapter_Title") 

                _mappingStyle("TXT", "Chapter_Title") 

                 

                 

                 

                function _mappingStyle(findStyle, changeGroup, changeStyle) 

                    app.findGrepPreferences = app.changeGrepPreferences = null;   

                    app.findGrepPreferences.appliedParagraphStyle = findStyle;   

                    app.changeGrepPreferences.appliedParagraphStyle = app.activeDocument.paragraphStyleGroups.item(changeGroup).paragraphStyles.item(changeStyl e);    

                    app.activeDocument.changeGrep();     

                    app.findGrepPreferences = app.changeGrepPreferences = null;   

                    }

                1.png

                2.png

                 

                by hasvi

                • 5. Re: How to map para style by script
                  Chinnadk Level 4

                  try replacing the first line with this

                   

                  _mappingStyle("TXT", "Chapters", "TXT")

                   

                  and remove the second line.

                   

                  Regards,

                  Chinna

                  • 6. Re: How to map para style by script
                    hasvi Level 1

                    Hi chinna

                     

                    thanks for your valuable information

                     

                    by

                    hasvi