2 Replies Latest reply on Jul 10, 2015 12:01 PM by Liphou

    [JS] MIDDLE DOT

    Liphou Level 1
      Hello,

      I do a test on the first character but I can not put the right code to "MIDDLE DOT" the \ u00B7 not funzione code.


                               if ( mesPara[i].characters[0].contents == 1396862068 || mesPara[i].characters[0].contents == '\u00B7' && leStyleOK == false) {// if Niv 02.2

                                    // routine

                                     mesPara[i].characters[0].contents = '\u25CF';

                               }



      Someone an idea thank you

       

        • 1. Re: [JS] MIDDLE DOT
          Laubender Adobe Community Professional & MVP

          Hi Philippe,

           

          I tried something like this with a minimal code like this and it worked:

           

          var myUnicodeString = "\u00B7";
          var myNewUnicodeString = "\u25CF";
          
          //Text frame selected:
          var myText = app.selection[0];
          var myParagraphs = myText.paragraphs.everyItem().getElements();
          
          for(var n=0;n<myParagraphs.length;n++){
          
              if(myParagraphs[n].characters[0].contents === myUnicodeString){
                  myParagraphs[n].characters[0].contents = myNewUnicodeString;
                  };
              
              };
          

           

          Before running the snippet (the left text frame), after running the snippet (the right text frame):

           

          Before-After-RunningSnippetCode.png

           

          Font: Mistral Regular

          Tested with InDesign CS5.5 on Mac OSX 10.6.8.

           

          Maybe we need the whole picture code wise with some explanations on how your document is built and how your paragraph style and character style is built? Used fonts?

           

          Uwe

          • 2. Re: [JS] MIDDLE DOT
            Liphou Level 1

            Thank you for your reply, I come back to this issue soon I test result