7 Replies Latest reply on Oct 14, 2008 1:42 AM by [Jongware]

    Indesign CS3. How to find "all caps" format text and change it to real uppercase?

    Kenji85
      I need to find all the text strings with all caps local formatting in an InDesign CS2 document, in order to replace it with real uppercase. I found this in the forum that can do the job, but it is not working in CS3 no matter how I change, anyone help????<br /><br />app.findPreferences = app.changePreferences = null; <br />var myResult = app.activeDocument.search( '', false, false, undefined, {capitalization:Capitalization.allCaps }) <br />for ( i = myResult.length-1; i >= 0 ; i-- ) <br />     makeUpperCase( myResult[i] ); function makeUpperCase ( myText ) <br />{ <br />     try // footnotes may disturb the job in InDesign CS2 <br />     { <br />          myText.capitalization = Capitalization.normal; <br />          myText.changecase( ChangecaseMode.uppercase ); <br />          myText.insertionPoints[-1].contents = '<\\UC>'; <br />          myText.insertionPoints[0].contents = '<UC>'; <br />     } <br />     catch(e) {} <br />}
        • 1. Re: Indesign CS3. How to find "all caps" format text and change it to real uppercase?
          Martin Fischer Level 2
          Hi Ken,

          the seach engine has changed in CS3.

          So you have to make changes like this:

          app.findTextPreferences = null;
          app.findTextPreferences.capitalization = Capitalization.allCaps;
          app.findChangeTextOptions.wholeWord = false;

          var myResult = app.activeDocument.findText()

          for ( i = myResult.length-1; i >= 0 ; i-- )
          makeUpperCase( myResult[i] );

          function makeUpperCase ( myText )
          {
          myText.capitalization = Capitalization.normal;
          myText.changecase( ChangecaseMode.uppercase );
          myText.insertionPoints[-1].contents = '<\\UC>';
          myText.insertionPoints[0].contents = '<UC>';
          }


          Do you need the Tags?
          If you don't, you can delete two lines or comment them:

          // myText.insertionPoints[-1].contents = '<\\UC>';
          // myText.insertionPoints[0].contents = '<UC>';


          Martin
          • 2. Re: Indesign CS3. How to find "all caps" format text and change it to real uppercase?
            Kenji85 Level 1
            Martin,

            This is great, it is working really fine. The indesign of this false cap thing is really giving mi problem. haha. You had been a great help, if I want to do the same thing in indesign plugin, is it possible???
            • 3. Re: Indesign CS3. How to find "all caps" format text and change it to real uppercase?
              [Jongware] Most Valuable Participant
              A plugin can do this and a lot more (google for "indesign plugin" and you can find some incredible free stuff: Tetris! An iTunes controller!). And JS is fast, but a plugin is, well, "immediate" comes to mind.

              But programming a plugin is hard, hard, hard. Besides, you can throw it away and start over with each new major version of ID. Each new version has new headers, and sometimes (not too often, hopefully), something internally is rewritten, and you have to use new APIs to do the same. The JavaScript support is pretty consistent over the latest three versions of ID, and even if a script does not work in a newer version, you can still put it
              b unmodified
              in an older version folder ("Scripts//Version 4.0 Scripts"), and chances are big it can run without problems. Even your script, of which Martin correctly states

              >the seach [sic] engine has changed in CS3.

              should run just fine in the 'older version' folder, because CS3 will recognize the older commands from there.
              • 4. Re: Indesign CS3. How to find "all caps" format text and change it to real uppercase?
                Kenji85 Level 1
                I see, I would like to pick up Indesign Plugin development but base on the SDK guide, it is quite hard to understand, wonder if there is any sample which is similiar to my issue here where I can pick and learn.
                • 5. Re: Indesign CS3. How to find "all caps" format text and change it to real uppercase?
                  Level 1
                  Hi Ken,

                  This is *much* easier to do in scripting. There is no point in learning the plug-in API in order to do something that scripting can already do perfectly. Use the plug-in API when you need to add something entirely new (such as a new capitalization style, for example); use scripting when you want to do something InDesign can already do (such as entering capital letters wherever the all caps style is found).

                  Thanks,

                  Ole
                  • 6. Re: Indesign CS3. How to find "all caps" format text and change it to real uppercase?
                    Kenji85 Level 1
                    The reason for picking up SDK is because in the paragraph style of indesign, it only provide all cap instead of real uppercase, it will be best if the case field of paragraph style is able to have an additional true uppercase option that can be selected instead of all cap.

                    Thanks
                    • 7. Re: Indesign CS3. How to find "all caps" format text and change it to real uppercase?
                      [Jongware] Most Valuable Participant
                      >true uppercase option that can be selected instead of all cap.

                      If you write a plugin that "applies" capitals, the underlying text will still be lowercase; but the text will be shown and printed as all caps. So, write a plugin that changes lowercase to capitals. ... Doesn't that sound familiar? Well, both options are already in InDesign.

                      ---

                      A few more good reasons to use scripts, rather than plugins:

                      They are platform independent -- you can use the same script on the Macintosh and on the Windows versions of InDesign. That might or might not be useful. For a plugin, you need a full programming environment for the Mac version, AND a full programming environment for the Win version (AND lots of experience on both platforms to get it to run).

                      They are easily adjustable. Designing, developing, coding, and maintaining a plugin takes a lot of overhead. A script can be opened directly from within InDesign into your local plain text editor, edited, saved, and run again.