6 Replies Latest reply on Dec 20, 2012 2:39 AM by snegig

    Find & Change Prop.

    snegig

      Hi Scripter.

       

      When we export all power math equation in my indesign cs4 files. I am facing some problem. All fraction/cf coding *frac*{xxx}{xxx}/*cf*{xxx}{xxx}.  But my file required every fraction need separately coding like:

       

      Example:

      (1) *frac*{xxx}{xxx} font size 10/12 color black

      (2) *frac*{xxx}{xxx} font size 7.5/10 color anno

      (3) *frac*{xxx}{xxx} font size 9/11 color megenta

      (4) *cf*{xxx}{xxx} font size 10/12 color black

      (2) *cf*{xxx}{xxx} font size 7.5/10 color anno

      (3) *cf*{xxx}{xxx} font size 9/11 color megenta

       

       

      We need:

      (1) *frac*{xxx}{xxx} font size 10/12 color black

      (2) *annofrac*{xxx}{xxx} font size 7.5/10 color anno

      (3) *mgfrac*{xxx}{xxx} font size 9/11 color megenta

      (4) *cf*{xxx}{xxx} font size 10/12 color black

      (2) *annocf*{xxx}{xxx} font size 7.5/10 color anno

      (3) *mgcf*{xxx}{xxx} font size 9/11 color megenta

       

      Can anybody have any script code find font/color then change/ any idea.

      Thanks for advance.

        • 1. Re: Find & Change Prop.
          Peter Kahrel Adobe Community Professional & MVP

          Two grep replacements:

           

          Find what: \*(frac|cf)(?=\*.+anno$)

          Replace with: *anno$1

           

          Find what: \*(frac|cf)(?=\*.+megenta$)

          Replace with: *mg$1

           

          But wouldn't it be easier to produce the correct output in the first place? And shouldn't it be 'magenta' instead of 'megenta'?

           

          Peter

          1 person found this helpful
          • 2. Re: Find & Change Prop.
            snegig Level 1

            Hi Peter,

            Sorry for confusion,

            Actually font size and font color just like help property, not actual text show in indesign files this is only finding property.

            Sir can is this possible we can find font/color by indesign panel than change by Java script. I have more than 40 indesign files and 8000 thousand power math equations.

            (2)

            Screen shot 2012-12-20 at 9.32.56 AM.png

            (2)

            Screen shot 2012-12-20 at 9.34.24 AM.png

            • 3. Re: Find & Change Prop.
              Peter Kahrel Adobe Community Professional & MVP

              It's still not very clear what you want.

              • 4. Re: Find & Change Prop.
                snegig Level 1

                var doc = app.activeDocument;

                app.findTextPreferences = app.changeTextPreferences = null;

                app.findTextPreferences.appliedFont = "ITC Stone Sans"

                app.findTextPreferences.fontStyle = "Medium"

                app.findTextPreferences.fillColor = "anno";

                app.findTextPreferences.findWhat = "*frac*";

                app.changeTextPreferences.changeTo = "*annofrac*";

                app.activeDocument.changeText();

                 

                Kindly check and anything better.

                • 5. Re: Find & Change Prop.
                  Sajeev Sridharan Level 4

                  I have used the same grep syntax which peter mentioned above, just I have added only one line, which finds the point size of the text. Hope this will help you.

                   

                  app.findGrepPreferences = app.changeGrepPreferences = null;

                  app.findGrepPreferences.appliedFont = "ITC Stone San"

                  app.findGrepPreferences.fontStyle = "Medium"

                  app.findGrepPreferences.pointSize = 7.5;

                  app.findGrepPreferences.findWhat = "\\*(frac|cf)(?=\\*.+anno$)";

                  app.changeGrepPreferences.changeTo = "*anno$1";

                  app.activeDocument.changeGrep();

                  app.findGrepPreferences = app.changeGrepPreferences = null;

                   

                   

                  app.findGrepPreferences = app.changeGrepPreferences = null;

                  app.findGrepPreferences.appliedFont = "ITC Stone San"

                  app.findGrepPreferences.fontStyle = "Medium"

                  app.findGrepPreferences.pointSize = 9;

                  app.findGrepPreferences.findWhat = "\\*(frac|cf)(?=\\*.+megenta$)";

                  app.changeGrepPreferences.changeTo = "*mg$1";

                  app.activeDocument.changeGrep();

                  app.findGrepPreferences = app.changeGrepPreferences = null;

                   

                   

                  Vandy

                  1 person found this helpful
                  • 6. Re: Find & Change Prop.
                    snegig Level 1

                    Thank you sooooooo much Vandy and Peter.