• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

Scripting Paragraph Styles

Community Expert ,
Aug 08, 2013 Aug 08, 2013

Copy link to clipboard

Copied

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?

TOPICS
Actions and scripting

Views

1.2K

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Adobe
Guru ,
Aug 08, 2013 Aug 08, 2013

Copy link to clipboard

Copied

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.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Aug 08, 2013 Aug 08, 2013

Copy link to clipboard

Copied

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.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guru ,
Aug 08, 2013 Aug 08, 2013

Copy link to clipboard

Copied

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.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Aug 08, 2013 Aug 08, 2013

Copy link to clipboard

Copied

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.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guru ,
Aug 08, 2013 Aug 08, 2013

Copy link to clipboard

Copied

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.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Aug 09, 2013 Aug 09, 2013

Copy link to clipboard

Copied

LATEST

Oh, that's not good! 

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines