2 Replies Latest reply on Jan 18, 2014 6:54 AM by gert verrept

    upper to lower case in "false" list

    gert verrept Level 2


      Is a thread I found. It converts the first char in a “bullet list” para style to lower case.
      Works great, but often we have lists for which, for several reasons, we cannot use the automatic “list” function (copy paste issues with other programs etc). The first char is the — (alt +0151) followed by a space (no tab) or the • (alt+0149) char.
      I cannot figure it out with a grep function, because there’s no mention of “lower case” possibility.
      Any suggestions?

        • 1. Re: upper to lower case in "false" list
          Peter Spier Most Valuable Participant (Moderator)

          I was able to modify Peter Kahrel's script fairly easily to change the third character instead of the first, which I think would do what you want.


          //Change THIRD character to lower case

          //Peter Kahrel wrote the original of this.


          app.findGrepPreferences = app.changeGrepPreferences = null;

          app.findGrepPreferences.appliedParagraphStyle = "List";


          // Third letter in paragraph to lower case:

          app.findGrepPreferences.findWhat = "^.{3}";

          found = app.activeDocument.findGrep();

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

            found[i].characters[2].changecase (ChangecaseMode.lowercase);



          I changed

          app.findGrepPreferences.findWhat = "^."; to

          app.findGrepPreferences.findWhat = "^.{3}"; so it picks up the first three characters in the paragraph instead of only one



          found[i].characters[0].changecase (ChangecaseMode.lowercase); to

          found[i].characters[2].changecase (ChangecaseMode.lowercase); so it changes the third character instead of the first.


          The script still depends on the text aving a named applied style (in this case I left it at "List") so you may need to edit more to change the style name to match your situation.


          And if you wanted, I think you could probably change app.findGrepPreferences.findWhat = "^."; to app.findGrepPreferences.findWhat = "^.+"; to find the entire paragraph, then change the index in the array to match any character position of your choice, but I don't think that has much purpose. One of the scripters could probably jazz this up with an interface that asks which character you want to change.

          • 2. Re: upper to lower case in "false" list
            gert verrept Level 2

            Thnkx a lot. Will be tested first thing monday morning in the real world