3 Replies Latest reply on Jun 12, 2014 6:24 AM by BEGINNER_X

    Find all Skew characters

    BEGINNER_X Level 3

      Hi ALL,

       

      Is it possible to find the Skew content in the document???

       

      For example, if the skew is like as 1 to 180 etc.,

       

      We can catch the skew characters like as below only

      app.findTextPreferences.skew = 8;       //this is possible

       

      app.findTextPreferences.skew = -20;    //this is possible

       

      Thanks in advance

      Siraj 

        • 1. Re: Find all Skew characters
          Chinnadk Level 4

          Hi Siraj,

           

          You can't skew the characters more than 85. Try the below code it finds the characters skewed from 1 to 85.

           

          var doc = app.activeDocument;
          for(var i=1;i<86;i++)
          {
                  app.findTextPreferences.skew = i;
                  var found = doc.findText();
                  for(var j=0;j<found.length;j++)
                  {
                          alert("Page Number : " + found[j].parentTextFrames[0].parentPage.name +"\r"+"Skew: "+ i+ "\r" + "Contents: " + found[j].contents);
                      }
              }
          

          Regards,

          Chinna

          • 2. Re: Re: Find all Skew characters
            Laubender Adobe Community Professional & MVP

            @Chinna – you can skew a text by -1.5 .

             

            So it seems to be best:

             

            If you do not have assigned any character styles:
            1. First find all not skewed text and assign a character style

            2. Search for text with character style "None" => all found texts are skewed by some value

             

            Or, if there are already character styles into play:

            1. First find all not skewed text and change the value of a property, that is never set to a special value throughout all texts in your document. Set this property to a special value.

            2. Do a search where this value is set to default => all found texts are skewed by some value!

             

            Here some code to show this with the property strikeThru that should be not used in the text!

            Find a different one that is working with findTextPrefernces or changeTextPreferences, if you are using strikeThru in the formatting of your text!

             

            //strikeThru is NOT used in the document!
            
            var mySkope = app.documents[0];
            
            app.findTextPreferences = app.changeTextPreferences = null;
            
            //First find all text that is not skewed:
            app.findTextPreferences.skew = 0;
            //Format the found text with a property not used in the text:
            app.changeTextPreferences.strikeThru = true;
            mySkope.changeText();
            
            app.findTextPreferences = app.changeTextPreferences = null;
            
            //Find all text that is not set with that property.
            //THAT must be the text skewed in various angles:
            app.findTextPreferences.strikeThru = false;
            var mySkewedTextsArray = mySkope.findText();
            
            app.findTextPreferences = app.changeTextPreferences = null;
            
            //Skewed texts contents written to console:
            //Or do here something else with the skewed text!
            for(var n=0; n<mySkewedTextsArray.length;n++){
                $.writeln(mySkewedTextsArray[n].contents);
                };
            
            //Reset the property used for the not-skewed text:
            app.findTextPreferences.strikeThru = true;
            app.changeTextPreferences.strikeThru = false;
            mySkope.changeText();
            
            app.findTextPreferences = app.changeTextPreferences = null;
            

             

            Uwe

            • 3. Re: Find all Skew characters
              BEGINNER_X Level 3

              Hi Laubender/Chinna,

               

              Thanks for your awesome reply.....