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
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);
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);
Copy link to clipboard
Copied
Yes, it seems to work. Thanks!
Have to build it into a bigger story..