This content has been marked as final. Show 5 replies
Which version of InDesign? What do you mean by "group"?
In CS3, you can use Next Style to have your styles alternate and then apply them to the selected text without the need for a script at all.
i use indesign Cs3.
two styles need more time to select lines and applied it, and i need to unified two styles in one script and applied it to all text.
line 1 style a
line 2 style b
line 3 style a
line 4 style b
line 5 style a
line 6 style b
how i can do to have a two styles in one command?
Set style a to have a Next Style of style b. Set style b to have a Next Style of style a.
Now selected the paragraphs and right click on Style A in the Paragraph Styles panel and choose Apply Style with Next Style.
No script necessary.
To script this, you would have to set each paragraph individually.
Just in case sorour needs it to do something more complicated, it's simply<br /><br />>for (var i=0; i<app.activeDocument.selection.paragraphs.length; i++)<br /><br />> if ((i & 1) == 0)<br /><br />> app.activeDocument.selection.paragraphs[i].appliedParagraphStyle = "style a";<br /><br />> else<br /><br />> app.activeDocument.selection.paragraphs[i].appliedParagraphStyle = "style B";<br /><br />>next i<br /><br />Select all paragraphs and run the scriptette.<br />This script, and any other solution, runs on <br />i paragraphs,<br />not <br />i lines.<br />Note the distinction; you can't apply a paragraph style to a single line, only to paragraphs. If you intended something for consecutive lines in a single paragraph, it'll get a bit more complicated.
OK Dave, it's good with Next style.