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

collect certain paragraphs

Engaged ,
Dec 08, 2017 Dec 08, 2017

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
543
Translate
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);

Translate
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);

Translate
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
LATEST

Yes, it seems to work. Thanks!

Have to build it into a bigger story..

Translate
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