2 Replies Latest reply on Mar 21, 2014 12:50 AM by Laubender

    Character style "[None]" is not working in my script. pls correct my script

    hasvi Level 1

      Actually I want to apply the character style “[None]” for Head B, so I write the script as like below but its show the error. please help for this


      app.findTextPreferences = app.changeTextPreferences = null;


      app.findTextPreferences.appliedParagraphStyle = "Head B";

      app.findTextPreferences.appliedCharacterStyle= "";

      app.changeTextPreferences.appliedParagraphStyle = "";

      app.changeTextPreferences.appliedCharacterStyle= "[None]";


      app.activeDocument.changeText ();

        • 1. Re: Character style "[None]" is not working in my script. pls correct my script
          Mi_D Level 3

          hi hasvi


          change the app.changeTextPreferences.appliedCharacterStyle= "[None]"; to below line and try

          app.changeTextPreferences.appliedCharacterStyle= app.activeDocument.characterStyles.item("[None]");



          • 2. Re: Character style "[None]" is not working in my script. pls correct my script
            Laubender Adobe Community Professional & MVP

            @Mi_D – another variant, a briefer one, would be:


            app.changeTextPreferences.appliedCharacterStyle = app.characterStyles[0];


            Since you cannot move that character style around in the Character Style Panel and you cannot remove it, you can always use the first one in the collection to target "[None]".



            Nearly the same goes for the paragraphStyle collection.

            But here you have to be very careful!


            Never confuse paragraphStyles[0] with paragraphStyles[1], be it called from the app or a specific document.


            paragraphStyles[0] is something like a contradiction, or better its name is something like a contradiction.

            It's not the basic paragraph style you can look up in the Paragraph Styles Panel.


            paragraphStyles[0] is apparently part of the collection of paragraph styles, but it is the NO paragraph style. Never ever change values of one of its properties! Never! Its name is localized. In my German version of InDesign its "[Kein Absatzformat]" (No Paragraph Style).


            paragraphStyles[1] instead is the basic paragraph style.

            Its name is localized and has changed in the history of InDesign versions. In my German versions of InDesign:


            CS3 and CS4: [Einfacher Absatz] (Basic Paragraph)

            CS5 and above: [Einf. Abs.] *


            So be careful calling it by name.


            Setting a swatch using its index would be dangerous!

            Swatches are freely moveable in the Swatches Panel. You cannot count on the fact that "[None]" is the first one in the collection.


            * Changing the name of the [Basic Paragraph] in the German localized version of InDesign from CS4 to CS5 was a really weird decision by Adobe.