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

collect certain paragraphs

Engaged ,
Dec 08, 2017 Dec 08, 2017

Copy link to clipboard

Copied

Hi guys!

I´d like to collect all paragraphs with a certain paragraph-style from a selected textframe.

Something like that:

myDoc = app.activeDocument,

myObj = myDoc.selection[0],

myParas = myObj.paragraphs.appliedParagraphStyle("para-style name");

of course that´s false..

In the post https://forums.adobe.com/message/5167244#5167244​ there is a kind of way to do that, but not very helpful for me.

Any ideas?

thanks in advance

TOPICS
Scripting

Views

459

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

correct answers 1 Correct answer

Enthusiast , Dec 08, 2017 Dec 08, 2017

var mySel = app.selection[0].parentStory;

var myParas = [];

for (var i=mySel.paragraphs.length-1; i>=0; i--) {

if (mySel.paragraphs.appliedParagraphStyle ==

app.activeDocument.paragraphStyles.itemByName("myStyleName")) {

myParas.push(mySel.paragraphs);

}

}

alert(myParas.length);

Votes

Translate

Translate
Enthusiast ,
Dec 08, 2017 Dec 08, 2017

Copy link to clipboard

Copied

var mySel = app.selection[0].parentStory;

var myParas = [];

for (var i=mySel.paragraphs.length-1; i>=0; i--) {

if (mySel.paragraphs.appliedParagraphStyle ==

app.activeDocument.paragraphStyles.itemByName("myStyleName")) {

myParas.push(mySel.paragraphs);

}

}

alert(myParas.length);

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
Engaged ,
Dec 08, 2017 Dec 08, 2017

Copy link to clipboard

Copied

LATEST

Yes, it seems to work. Thanks!

Have to build it into a bigger story..

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