4 Replies Latest reply on Aug 6, 2013 1:56 AM by artCraft2

    character + appliedFont

    artCraft2

      Hi Forum,

       

      I tried with the below script to find a character "•" and its font name...

       

      but result, is "Undefined".

       

      Tf = app.activeDocument.pages.everyItem().textFrames.everyItem().getElements();

      for(i=0; i<Tf.length; i++) {

      var nf = Tf[i].contents;

      for(j=0; j<nf.length; j++) {

      if (nf[j] == "•" &&

      nf[j].appliedFont ==  app.fonts.itemByName("Courier New")){

              alert ("Defults Fonts found, convert to Anyother")

              }}}

       

      Please help on this...

        • 1. Re: character + appliedFont
          csm_phil Level 4

          Hi artCraf2,

           

          Please try the below JS code. This is simple way to find the specific character with respective font name not font style (bold, italic), If you want just add the font style.

           

           

          app.findTextPreferences = app.changeTextPreferences = NothingEnum.nothing;
          app.findTextPreferences.findWhat = "•";
          app.findTextPreferences.appliedFont = "Courier New";
          //If you want find a bullet character along with bold format use the below line. above line is only for font name.
          //app.findTextPreferences.appliedFont = "Courier New\tBold";
          var myFindFont = app.activeDocument.findText();
          for(var i=0; i<myFindFont.length; i++){
              alert ("Defults Fonts found, convert to Anyother")
              }
          

           

          thx,

          csm_phil

          1 person found this helpful
          • 2. Re: character + appliedFont
            artCraft2 Level 1

            Hi csm_phil,

             

            How Can i get alert, if my findWhat.appliedFont not equal to Courier New font.

             

            I have just tried like this...

             

             

            app.findTextPreferences = app.changeTextPreferences = NothingEnum.nothing;

            app.findTextPreferences.findWhat = "•";

            app.findTextPreferences.appliedFont = "Minion Pro"; //if not in Minion pro font.....

            //If you want find a bullet character along with bold format use the below line. above line is only for font name.

            //app.findTextPreferences.appliedFont = "Courier New\tBold";

            var myFindFont = app.activeDocument.findText();

            for(var i=0; i<myFindFont.length; i++){

                if(myFindFont!== true)

                alert ("• is not in Courier Font, convert to app. font")

                }

            • 3. Re: character + appliedFont
              Trevorׅ Adobe Community Professional
              app.findTextPreferences = app.changeTextPreferences = NothingEnum.nothing;
              app.findTextPreferences.findWhat = "•";
              var myFindFont = app.activeDocument.findText();
              for(var i=0; i<myFindFont.length; i++) {
                  if (myFindFont[i].appliedFont != "Courier New")alert ("Not Courier")
                  }
              
              • 4. Re: character + appliedFont
                artCraft2 Level 1

                Thank you! J, Trevor,