6 Replies Latest reply on Aug 9, 2013 5:25 AM by Chuck Uebele

    Scripting Paragraph Styles

    Chuck Uebele Adobe Community Professional & MVP

      Just curious if it's possible to script (create and or refer to) paragraph styles, and if so what would be the syntax to apply them to a paragraph in a block of text?  Is this or will this be something captured by ScriptListener?

        • 1. Re: Scripting Paragraph Styles
          Michael L Hale Level 5

          I have not done any scripting of paragraph styles but a quick test shows that applying a style is recorded and looks very straightforward. Creating a new style is also recorded but looks like it sets overrides to an existing style so may be a littler tricker to script.

           

          I can find a lot of detail about the paragraph style of a textLayer in the descriptor but not the name of the style. I also don't see a way to determine anything about the styles in a document. Names, current or selected style, that kind of thing.

           

          Not saying it is not possiblle, just nothing from a quick look.

          1 person found this helpful
          • 2. Re: Scripting Paragraph Styles
            Chuck Uebele Adobe Community Professional & MVP

            Thanks, Mike.  These are some of the questions I have and was thinking someone should submit a feature request if those features are not available.

             

            I would like to see:

             

            1. Being able to script a style, and check to see if one of that name all ready exists.

             

            2. Be able to easily dected how many paragraphs are in a text block.  I'm sure this can be done, but something like textRefLayer.text.paragraphs.length

             

            3. Then be able to take the paragraph number either drived from the above of other means and assign a style to that paragraph.

             

            This would be so much better than the roundabout ways text is formatted differently in the same text block.

            • 3. Re: Scripting Paragraph Styles
              Michael L Hale Level 5

              I think in Photoshop paragraph marks are really just line break chars. So you could search the textItem contents for line break chars to get the number of paragraphs.

               

              As for the rest, I wouldn't hold my breath.

              • 4. Re: Scripting Paragraph Styles
                Chuck Uebele Adobe Community Professional & MVP

                Yea, I know I could break apart a text block by the line breaks, but I wonder how you would secifiy which paragraph to apply a style without some sort of paragraph ID.  I haven't looked at the actionDescriptor code yet, as you mentioned, but I'm wondering if the name is some number ID.

                • 5. Re: Scripting Paragraph Styles
                  Michael L Hale Level 5

                  I would say if anything the new paragraph styles have made scripting text layer harder if you want to do more that what is supported in the Object Model. It looks like there isn't a paragraph ID. It looks like it is using a start and end char range. So now we have to deal with paragraph ranges in addition to text ranges.

                  • 6. Re: Scripting Paragraph Styles
                    Chuck Uebele Adobe Community Professional & MVP

                    Oh, that's not good!