[JS][CS5] finding instances of a Paragraph style, and doing something to the parentTextFrame
Hello,
From being helped earlier with looping through objects looking for a fill color, and then deleting found objects, I decided to try and reuse the loop for another purpose.
I'd like to loop through all stories in a document, finding those who have a particular paragraph style applied to them, and then 'climb out' using .parentTextFrame[0] to move the containing text frame.
Here's what I have:
Main();
function Main() {
var doc = app.activeDocument;
var stories = doc.stories;
var STYLE = doc.paragraphStyles.item("STYLE");
for (var i = stories.length-1; i >= 0; i--) {
if (stories.appliedParagraphStyle == STYLE) stories.parentTextFrames[0].move([3,5]);
}
}
The script executes but the frames don't move.
Changing
"if (stories.appliedParagraphStyle == STYLE) stories.parentTextFrames[0].move([3,5]);"
to
"if (stories.appliedParagraphStyle == STYLE) stories.remove();"
deletes the story.
I'm thankful for any help. Looks like this should work in theory, but obviously there is something wrong..