28 Replies Latest reply on May 3, 2015 11:34 PM by selvam214

    Catch the kerning value

    selvam214 Level 1

      Hi,

      I,m trying to catch the kerning value above -100, but can't work this code. Kindly guide to me.

       

       

      for(i=0; i<myPages.length; i++)

      {

          var myTF = myPages[i].textFrames.everyItem().getElements();

              for(k=0; k<myTF.length; k++)

          {

              var myLines= myTF[k].lines.everyItem().getElements();

                      for(l=0; l<myLines.length; l++)

              {

                 var myWords = myLines[l].characters.everyItem().getElements();

                 for(w=0; w<myWords.length; w++)

                  {

           if(myWords[w].kerningValue <= -100)

                      {

      \\result in report

                          }

                      }

                  }

              }

          }

        • 1. Re: Catch the kerning value
          Chinnadk Level 4

          Try this,

           

          var doc = app.activeDocument, 
              _stories = doc.stories; 
          
          for(var i=0;i<_stories.length;i++) 
          { 
                  var characters = _stories[i].characters; 
                  for(var j=0;j<characters.length;j++) 
                  { 
                          if(characters[j].kerningMethod != "Metrics" && characters[j].kerningMethod != "Optical")
                          {
                                  if(characters[j].kerningValue <= -100)
                                  {
                                          alert(characters[j].kerningValue);
                                      }
                              }
                      } 
              }
          
          

           

          Regards,

          Chinna

          • 2. Re: Catch the kerning value
            selvam214 Level 1

            Hi Chinna,

            Working fine, I need an additional option to select before-and-after one character with this kerning, can you please help for this.

             

            Screen shot 2015-01-02 at 1.11.26 PM.png

            • 3. Re: Re: Catch the kerning value
              Chinnadk Level 4

              Try this,

               

              var doc = app.activeDocument, 
                  _stories = doc.stories; 
              
              for(var i=0;i<_stories.length;i++) 
              { 
                      var characters = _stories[i].characters; 
                      for(var j=0;j<characters.length;j++) 
                      { 
                              if(characters[j].kerningMethod != "Metrics" && characters[j].kerningMethod != "Optical")
                              {
                                      if(characters[j].kerningValue == -100 && characters[j].contents == "c" && characters[j+1].contents == ",")
                                      {
                                              alert(characters[j].kerningValue);
                                          }
                                  }
                          } 
                  }
              

               

              Regards,

              Chinna

              • 4. Re: Catch the kerning value
                selvam214 Level 1

                Thanks for these Chinna.

                • 5. Re: Catch the kerning value
                  selvam214 Level 1

                  Hi Chinna and all,

                  Possible to attack if any other way? Because, this method very slow to capture these characters (600 pages - find character by character). Please help for this.

                   

                   

                  var myColor = app.activeDocument.colors.add();
                  myColor.name = "URL";
                  myColor. model = ColorModel.process;
                  myColor.colorValue = [15, 100, 100, 0];

                   

                   

                   

                  var doc = app.activeDocument,

                      _stories = doc.stories;

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

                  {

                          var characters = _stories[i].characters;

                          for(var j=0;j<characters.length;j++)

                          {

                                  if(characters[j].insertionPoints[-1].kerningMethod != "Metrics" && characters[j].insertionPoints[-1].kerningMethod != "Optical")

                                  {

                                          if(characters[j].insertionPoints[-1].kerningValue <= -99)

                                          {

                                                  characters[j+1].fillColor = myColor;

                                                  characters[j].fillColor = myColor;

                                              }

                                      }

                              }

                      }

                  • 6. Re: Catch the kerning value
                    Peter Kahrel Adobe Community Professional & MVP

                    Getting all characters into an array in one go, rather than addressing the character collection all the time, will speed things up considerably. And iterating through the array back to front so that the array length is computed just once will probably make a difference too.

                     

                    var characters = doc.stories.everyItem().characters.everyItem().getElements();
                    for (var i = characters.length-1; i >= 0; i--) {
                       . . .
                       . . .
                    }
                    

                     

                    Note that the scripts given in this thread don't see footnotes and tables, you'll have to add that functionality.

                     

                    Peter

                    • 7. Re: Catch the kerning value
                      Harbs. Level 6

                      The most efficient way is probably by getting an array of properties:

                      myStory.characters.everyItem().properties

                       

                      You then loop through that and find the character properties you are looking for. The index within the array would be the character index.

                      • 8. Re: Catch the kerning value
                        Dirk Becker Level 4

                        Nice idea, Harbs.

                         

                        I fear that it might be too time consuming to determine all properties, create objects for each and then discard most of that. On the other hand that operation should be very optimized for purposes of the IDML generator.


                        Please also try multiple arrays, e.g. myStory.characters.everyItem().whateverProperty for the few properties that you actually care about.

                         

                        On the other hand, both your approaches only produce a single instance of Character object per character, so if you need many properties my approach will slow down. If you can reuse those objects from Peter's array later on (e.g. for changes), that might give even more advantage.

                         

                        Btw, if/as some considered properties are actually attributes, I'd subdivide the story in TextStyleRuns and check those attributes once (again with those different approaches) before looking at the individual characters of the few matching TSR. Besides I'd not use insertion points from characters as the OP, that just creates another bunch of temporary text proxy objects.

                         

                        And please tell us the winner ;-)

                        • 9. Re: Catch the kerning value
                          Peter Kahrel Adobe Community Professional & MVP

                          Dirk,

                           

                          Yes, I thought that getting the insertion points would be quicker (because kernValues are properties of insertion points), but the OP wants to highlight the characters with certain kern values, so I guess that it doesn't matter much because you'll need to create proxies whether you get insertion points and then their associated characters, or characters and then their associated insertion points.

                           

                          P.

                          • 10. Re: Catch the kerning value
                            Dirk Becker Level 4

                            Hmm,

                             

                            I must confess that in scripting I've not yet worked with kern values, but the OMV claims the kerningValue property is also available for characters as for all other text objects. Are there any circumstances (maybe L2R scripts?) where they could differ between Character and InsertionPoint? Otherwise I still don't see the need to convert from Character to InsertionPoint.

                             

                            Dirk

                            • 11. Re: Catch the kerning value
                              Peter Kahrel Adobe Community Professional & MVP

                              I've scripted a lot with kerning values, but must confess I never looked beyond the insertion point as an object with the kerning value property (because to have kerning values of objects other than insertion points seems rather counter-intuitive). Setting a character's kv sets its second insertionPoint's kv. So the OP's script could have this test:

                               

                              if(characters[j].kerningMethod != "Metrics" && . . .

                               

                              which would further speed up the script.

                               

                              P.

                              • 12. Re: Catch the kerning value
                                Harbs. Level 6

                                AFAIK, there's no practical difference between the properties of an insertion point and the properties of the following character. Each would give you the same values.

                                 

                                I think setting the values of the characters is safer because I don't think setting the insertion point values usually affect the character (but vice versa is true).

                                • 13. Re: Catch the kerning value
                                  Dirk Becker Level 4

                                  Setting the properties of an insertion point makes sense when you in the same step provide / insert text.

                                   

                                  myInsertionPoint.properties = { contents: "inserted", ligatures: true };

                                  • 14. Re: Catch the kerning value
                                    Harbs. Level 6

                                    True. It also makes sense if you want to set the properties of text that will subsequently be typed by the user.

                                    • 15. Re: Catch the kerning value
                                      selvam214 Level 1

                                      Hi Dirk/Harbs,

                                      I have little difficult to recognize from your discussion, I have changed the code (below) as per Peter guidance. Once changed, small changes for the time saving, but not meet our target.

                                       

                                       

                                      Can you please change if any wrong or other improvement.

                                       

                                      -----------------

                                      var myColor = app.activeDocument.colors.add();
                                      myColor.name = "URL";
                                      myColor. model = ColorModel.process;
                                      myColor.colorValue = [15, 100, 100, 0];

                                      var result = []; 

                                      var doc = app.activeDocument,

                                       

                                      //New code for speed process

                                       

                                      var characters = doc.stories.everyItem().characters.everyItem().getElements(); 

                                      for (var j = characters.length-1; j >= 0; j--)

                                          {
                                                  if(characters[j].insertionPoints[-1].kerningMethod != "Metrics" && characters[j].insertionPoints[-1].kerningMethod != "Optical")
                                                  {
                                                          if(characters[j].insertionPoints[-1].kerningValue <= -99)
                                                          {
                                                                  characters[j+1].fillColor = myColor;
                                                                  characters[j].fillColor = myColor;

                                       

                                                              }
                                                      }
                                              }

                                       

                                      ------------------------

                                      • 16. Re: Catch the kerning value
                                        Peter Kahrel Adobe Community Professional & MVP

                                        Use characters[j].kerningMethod instead characters[j].insertionPoints[-1].kerningMethod (three times), though if it makes much difference I don't know.

                                        • 17. Re: Catch the kerning value
                                          selvam214 Level 1

                                          Hi Peter, Now its working fine, thanks for your guidance. All: Thanks for your valuable discussion and the effort. Selva

                                          • 18. Re: Catch the kerning value
                                            Harbs. Level 6

                                            1) getElements() makes very little difference for character objects because the characters always need to be resolved when referenced anyways.

                                            2) The following code should make a measurable difference:

                                            var myColor = app.activeDocument.colors.add();
                                            myColor.name = "URL";
                                            myColor. model = ColorModel.process;
                                            myColor.colorValue = [15, 100, 100, 0];    
                                            var result = []; 
                                            var doc = app.activeDocument,
                                            
                                            //New code for speed process
                                            var characters = doc.stories.everyItem().characters.everyItem();
                                            var len = characters.length;
                                            for (var j = len-1; j >= 0; j--)
                                            {
                                              var props = characters[j].properties;
                                              if(props.kerningMethod != "Metrics" && props.kerningMethod != "Optical")
                                              {
                                                if(props.kerningValue <= -99)
                                                {
                                                  characters[j+1].fillColor = myColor;
                                                  characters[j].fillColor = myColor;
                                                }
                                              }
                                            }
                                            

                                            3) I was talking about something like this:

                                            var myColor = app.activeDocument.colors.add();
                                            myColor.name = "URL";
                                            myColor. model = ColorModel.process;
                                            myColor.colorValue = [15, 100, 100, 0];    
                                            var result = []; 
                                            var doc = app.activeDocument,
                                            
                                            var stories = doc.stories.everyItem().getElements();
                                            for(var i=0;i<stories.length;i++){
                                                processStory(stories[i],myColor);
                                            }
                                            function processStory(story,color){
                                              var props = story.characters.everyItem().properties;
                                              for(var i=0;i<props.length;i++){
                                                if(props[i].kerningMethod != "Metrics" && props[i].kerningMethod != "Optical" && props[i].kerningValue <= -99){
                                                  if(i<props.length-1){
                                                    story.characters.itemByRange(i,i+1).fillColor = color;
                                                  }
                                                }
                                              }
                                            }
                                            
                                            • 19. Re: Catch the kerning value
                                              selvam214 Level 1

                                              Hi Harbs,

                                              Can you please check this error?

                                               

                                              Screen shot 2015-04-20 at 8.16.23 PM.png

                                              • 20. Re: Catch the kerning value
                                                Harbs. Level 6

                                                I did not look at the code well enough.

                                                This:

                                                var doc = app.activeDocument,

                                                should be:

                                                var doc = app.activeDocument;

                                                • 21. Re: Catch the kerning value
                                                  Marc Autret Level 4

                                                  Hi all,

                                                   

                                                  As recommended by Dirk in comment #8 “if/as some considered properties are actually attributes, I'd subdivide the story in TextStyleRuns and check those attributes once … before looking at the individual characters of the few matching.” There is a safe bet that this approach will be most efficient in the case under study as in many similar situations.

                                                   

                                                  Here is the kind of implementation I'd suggest:

                                                   

                                                  // Your settings
                                                  // ---
                                                  const COLOR_SETTINGS = {name:"URL", model:+ColorModel.process, colorValue:[15, 100, 100, 0]},
                                                        MIN_KERNING = -99;  // The value under which we'll operate
                                                  
                                                  // Some constants
                                                  // ---
                                                  const CHAR_PTN = '/character[',
                                                        CHAR_PTN_SZ = CHAR_PTN.length,
                                                        RE_MANUAL = new RegExp(app.translateKeyString("$ID/Manual"),'g');
                                                  
                                                  // Some variables
                                                  // ---
                                                  var doc = app.activeDocument,
                                                      myColor = doc.colors.itemByName(COLOR_SETTINGS.name),
                                                      txRanges = doc.stories.everyItem().textStyleRanges,
                                                      trace, r, z, i, t, s, p, x;
                                                  
                                                  // Create the color (if needed)
                                                  // ---
                                                  if( !myColor.isValid ){ myColor = doc.colors.add(COLOR_SETTINGS); }
                                                  
                                                  
                                                  // ===================================================================
                                                  // Now let's try to speed up the process using Dirk's suggestion.
                                                  // ===================================================================
                                                  
                                                  // First, record the 'trace' of the Manual kerning method found in
                                                  // style ranges. A special string format is used here for speed purpose.
                                                  // Note: kerningValue couldn't be extracted directly at this stage
                                                  // because this property isn't available in Optical and Metrics modes.
                                                  // ---
                                                  trace = txRanges.everyItem().kerningMethod.join(',')
                                                          .replace(RE_MANUAL,'1').replace(/[^,1]+/g,'0');
                                                  
                                                  // Loop through the manual-kern ranges. The trace string looks like
                                                  // "0,0,0,1...0,1,0" where each 1 reflects the position of a candidate.
                                                  // ---
                                                  for( r=[], z=0, i=trace.length ; 0 <= i && -1 != (i=trace.lastIndexOf('1',i)) ; i-- )
                                                      {
                                                          // Get back the textStyleRange (t), and skip items
                                                          // whose kerning value is over MIN_KERNING
                                                          // ---
                                                          if( MIN_KERNING < (t=txRanges[i/2]).kerningValue ) continue;
                                                         
                                                          // Resolve t as a pure Text instance (using getElements)
                                                          // and grab its specifier (path) to minimize DOM access.
                                                          // Warning: t might have a length > 1 (contiguous characters)
                                                          // ---
                                                          s = (t=t.getElements()[0]).toSpecifier();
                                                         
                                                          // Get the index of the last character (tricky!)
                                                          // ---
                                                          x = parseInt(s.substr(p=CHAR_PTN_SZ+s.lastIndexOf(CHAR_PTN)),10);
                                                  
                                                          // Try to increase the range by 1 character to the right.
                                                          // (This could fail if t ends the Story flow.)
                                                          try{ t = resolve(s.substr(0,p)+(1+x)+s.substr(p+(''+x).length)); }
                                                          catch(_){}
                                                         
                                                          // Store the result
                                                          r[z++] = t;
                                                      }
                                                  
                                                  // Colorize the results
                                                  // ---
                                                  while( t=r.pop() ){ t.fillColor = myColor; }
                                                  
                                                  alert( localize("%1 location%2 found.", z||'No', 1 < z ? 's' : '') );
                                                  
                                                  

                                                   

                                                  Try and tell.

                                                   

                                                  @+

                                                  Marc

                                                  • 22. Re: Catch the kerning value
                                                    selvam214 Level 1

                                                    Hi Marc,

                                                    Can you please check this error (line number 44 as per your code),

                                                    Screen shot 2015-04-27 at 11.08.54 AM.png

                                                    Selva

                                                    • 23. Re: Catch the kerning value
                                                      Marc Autret Level 4

                                                      Hi Selva,

                                                       

                                                      From the fact that the error occurs at "Line: 84" I conclude that you have embedded my snippet in a larger code.

                                                      So, from now, we need to know the whole context.

                                                       

                                                      @+

                                                      Marc

                                                      • 24. Re: Catch the kerning value
                                                        selvam214 Level 1

                                                        Hi Marc,

                                                        Here is my complete code.

                                                        I have created a document with one page and tested this, working fine for this code. But project's file not working and error occurred. Kindly help for this.

                                                         

                                                         

                                                         

                                                         

                                                         

                                                         

                                                         

                                                         

                                                         

                                                        //updated based on the forum discussion of "Catch the kerning value"

                                                         

                                                        var PGBK_mystartDate;

                                                        PGBK_mystartDate =new Date();

                                                         

                                                        //~ Define variables

                                                        var myDoc = app.activeDocument;

                                                        var myDocPath = myDoc.filePath;

                                                        var myDocName = myDoc.name;

                                                         

                                                        var found = new Array (50);var w = new Window ('palette', "Find METRICS characters - progressing …");w.pbar = w.add ('progressbar', undefined, 15, found.length);w.pbar.preferredSize.width = 300;w.show();for (var i = 0; i < found.length; i++){w.pbar.value = i+1;$.sleep(20);}//end progress bar

                                                         

                                                        Fnd = new Array();

                                                        FoundContents = new Array();

                                                        totalArray = new Array();

                                                        try

                                                        {

                                                            var myColor = app.activeDocument.colors.item("URL").name;

                                                            }

                                                        catch(myError)

                                                        {

                                                        var myColor = app.activeDocument.colors.add(); 

                                                        myColor.name = "URL"; 

                                                        myColor. model = ColorModel.process; 

                                                        myColor.colorValue = [15, 100, 100, 0];   

                                                        }

                                                            var result = [];  

                                                            var doc = app.activeDocument; 

                                                        //new code from forum

                                                         

                                                        // Your settings 

                                                        // --- 

                                                        const COLOR_SETTINGS = {name:"URL", model:+ColorModel.process, colorValue:[15, 100, 100, 0]}, 

                                                              MIN_KERNING = -60;  // The value under which we'll operate 

                                                         

                                                        // Some constants 

                                                        // --- 

                                                        const CHAR_PTN = '/character[', 

                                                              CHAR_PTN_SZ = CHAR_PTN.length, 

                                                              RE_MANUAL = new RegExp(app.translateKeyString("$ID/Manual"),'g'); 

                                                         

                                                        // Some variables 

                                                        // --- 

                                                        var doc = app.activeDocument, 

                                                            myColor = doc.colors.itemByName(COLOR_SETTINGS.name), 

                                                            txRanges = doc.stories.everyItem().textStyleRanges, 

                                                            trace, r, z, i, t, s, p, x; 

                                                         

                                                        // Create the color (if needed) 

                                                        // --- 

                                                        if( !myColor.isValid ){ myColor = doc.colors.add(COLOR_SETTINGS); } 

                                                         

                                                         

                                                        // =================================================================== 

                                                        // Now let's try to speed up the process using Dirk's suggestion. 

                                                        // =================================================================== 

                                                         

                                                        // First, record the 'trace' of the Manual kerning method found in 

                                                        // style ranges. A special string format is used here for speed purpose. 

                                                        // Note: kerningValue couldn't be extracted directly at this stage 

                                                        // because this property isn't available in Optical and Metrics modes. 

                                                        // --- 

                                                        trace = txRanges.everyItem().kerningMethod.join(',') 

                                                                .replace(RE_MANUAL,'1').replace(/[^,1]+/g,'0'); 

                                                         

                                                        // Loop through the manual-kern ranges. The trace string looks like 

                                                        // "0,0,0,1...0,1,0" where each 1 reflects the position of a candidate. 

                                                        // --- 

                                                        for( r=[], z=0, i=trace.length ; 0 <= i && -1 != (i=trace.lastIndexOf('1',i)) ; i-- ) 

                                                            { 

                                                                // Get back the textStyleRange (t), and skip items 

                                                                // whose kerning value is over MIN_KERNING 

                                                                // --- 

                                                                if( MIN_KERNING < (t=txRanges[i/2]).kerningValue ) continue; 

                                                                

                                                                // Resolve t as a pure Text instance (using getElements) 

                                                                // and grab its specifier (path) to minimize DOM access. 

                                                                // Warning: t might have a length > 1 (contiguous characters) 

                                                                // --- 

                                                                s = (t=t.getElements()[0]).toSpecifier(); 

                                                                

                                                                // Get the index of the last character (tricky!) 

                                                                // --- 

                                                                x = parseInt(s.substr(p=CHAR_PTN_SZ+s.lastIndexOf(CHAR_PTN)),10); 

                                                         

                                                                // Try to increase the range by 1 character to the right. 

                                                                // (This could fail if t ends the Story flow.) 

                                                                try{ t = resolve(s.substr(0,p)+(1+x)+s.substr(p+(''+x).length)); } 

                                                                catch(_){} 

                                                                

                                                                // Store the result 

                                                                r[z++] = t; 

                                                            } 

                                                         

                                                        // Colorize the results 

                                                        // --- 

                                                        while( t=r.pop() ){ t.fillColor = myColor; } 

                                                         

                                                        //~ alert( localize("%1 location%2 found.", z||'No', 1 < z ? 's' : '') );

                                                         

                                                        //end new code from forum

                                                         

                                                        //~     }

                                                        reportPage = new Array();

                                                        reportContents = new Array();

                                                        app.findTextPreferences = app.changeTextPreferences = null;

                                                        app.findTextPreferences.fillColor = myColor;

                                                        var myFoundColor = app.activeDocument.findText();

                                                        //Start the line count

                                                        //End the line count

                                                        for(f=0; f<myFoundColor.length; f++)

                                                        {

                                                            var myFoundPage =  myFoundColor[f].parentTextFrames[0].parentPage.name;

                                                             Fnd.push(myFoundPage)

                                                            var myFoundContents = myFoundColor[f].contents;

                                                        //~     Fnd.push(myFoundContents)

                                                            var myFoundLine = myFoundColor[f].lines[0].contents;

                                                        //~     Fnd.push(myFoundLine)

                                                            var myFoundWords = myFoundColor[f].words[0].contents;

                                                        //~     Fnd.push(myFoundWords)

                                                         

                                                         

                                                         

                                                            FoundContents.push(myFoundPage + "\t" + myFoundColor[f].parentStory.characters.itemByRange(myFoundColor[f].parentTextFrames[0].li nes[0].index, myFoundColor[f].index).lines.length + "\t" + myFoundContents +"\t" +myFoundWords+"\t" +myFoundLine +"\r")

                                                            }

                                                        var myoutput3 = FoundContents.toString().replace(/\t\t/g, "\t")

                                                        var myoutput1 = myoutput3.toString().replace(/\r\r/g, "\r")

                                                        var myoutput2 = myoutput1.toString().replace(/\t\t/g, "\t")

                                                        var myoutput = myoutput2.toString().replace(/,/g, "")

                                                         

                                                        //~  String(FoundContents.contents).replace(/,/g, "\r")

                                                        //the urls are available, report creation

                                                        if (Fnd.length != 0)

                                                        {

                                                            var myDoc1 = app.documents.add();

                                                            var myTextFrame1 = myDoc1.pages[0].textFrames.add({

                                                                geometricBounds: [-100, -100, 200, 200]

                                                            });

                                                            myTextFrame1.insertionPoints[-1].contents = "The list of characters are merged and converted to the special character. \r\rIf any junk characters: try to open with \"Apple Macintosh\" Version.\r\rPage No:\tLine Number:\tMerged the Texts:\tMerged Texts Wrod:\tMerged Texts Line:\r" + myoutput;

                                                            var myText = myTextFrame1.parentStory;

                                                            var myReport = myText.exportFile(ExportFormat.textType, File(myDocPath + "/" + myDoc.name.split(".indd").join("_Merged.xls")));

                                                            myDoc1.close(SaveOptions.no);

                                                            var mydco = app.documents.item(0).swatches.item("URL").remove();

                                                            var PGBK_myendDate= new Date();

                                                            var PGBK_TimeSpan=(PGBK_myendDate.getTime()-PGBK_mystartDate.getTime())/1000;       

                                                        alert("No of occurence merged: " + Fnd.length + "\r\r" + "Report is saved in the document location."+"\r\r\|Time taken: "+ PGBK_TimeSpan + ' seconds'+"\|",);

                                                        }

                                                         

                                                        //the urls not available, color delete and alert

                                                        if (Fnd.length == 0)

                                                        {

                                                            var myTextFile = File(myDocPath + "/" + myDoc.name.split(".indd").join("_Merged.xls"));

                                                            myTextFile.open("w");

                                                            myTextFile.write("No merged the Special Characters")

                                                            var mydco = app.documents.item(0).swatches.item("URL").remove();

                                                            myTextFile.close();

                                                            alert("Not found in this Document")

                                                        }

                                                        • 25. Re: Catch the kerning value
                                                          Marc Autret Level 4

                                                          Hi Selva,

                                                           

                                                          Hmmm, it's hard to debug! It looks like you have mixed snippets from different sources so your entire script is really difficult to understand.

                                                           

                                                          I suggest you streamline your code first. Create a functional module for each part of your algorithm, cleanup duplicate processes (e.g. color creation), etc. Then we'll have more chance to identify the cause of the bug.

                                                          Also, if a simple document works while your project documents don't, it could be useful to know what is specific to those documents in terms of text structure.

                                                           

                                                          @+

                                                          Marc

                                                          • 26. Re: Catch the kerning value
                                                            selvam214 Level 1

                                                            Hi Marc,

                                                            This is our master page issue. If it possible to change your code must ignore the master page element?

                                                             

                                                             

                                                                if( MIN_KERNING < (t=txRanges[i/2]).kerningValue ) continue; 
                                                            • 27. Re: Catch the kerning value
                                                              selvam214 Level 1

                                                              Hi Marc,

                                                              I have changed the steps as per below,

                                                               

                                                              1. Remove master page elements

                                                              2. Find the merged characters (as per your code)

                                                              3. Apply the color

                                                              4. Get the report from the applied color

                                                              5. Close the document without save option.

                                                               

                                                              Now its working fine, but I need to run this tool without the master page result, so i'm waiting for your reply.

                                                               

                                                               

                                                               

                                                               

                                                              Important:

                                                              But your code so much better time saving compare our old code. This is great. Thanks for your work. Codes are very short and the way to approach is very tremendous.

                                                               

                                                              Thanks again,

                                                              Selva

                                                              • 28. Re: Catch the kerning value
                                                                selvam214 Level 1

                                                                Hi All,

                                                                If multiple text frames in a page, the tool not recognize the text, please advice on this.

                                                                 

                                                                Example: below each texts are in a separate unlink frames,

                                                                Screen shot 2015-05-04 at 12.03.34 PM.png