Skip to main content
Participant
March 31, 2008
Question

two paragraph style in one script?

  • March 31, 2008
  • 5 replies
  • 440 views
Hi all,

I have two paragraph styles, the first is applied to first, 3°, 5°, ... lines, and the second to second, 4°, 6°, 8°... lines.
how i can group them in the one script?

Please revert if you have not clear.

Thanks & Regards
This topic has been closed for replies.

5 replies

Participant
April 1, 2008
OK Dave, it's good with Next style.

thanks
Jongware
Community Expert
Community Expert
March 31, 2008
Just in case sorour needs it to do something more complicated, it's simply<br /><br />>for (var i=0; i<app.activeDocument.selection[0].paragraphs.length; i++)<br /><br />> if ((i & 1) == 0)<br /><br />> app.activeDocument.selection[0].paragraphs.appliedParagraphStyle = "style a";<br /><br />> else<br /><br />> app.activeDocument.selection[0].paragraphs.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.
Inspiring
March 31, 2008
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.

Dave
Participant
March 31, 2008
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.

es:

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?

Thanks
Inspiring
March 31, 2008
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.

Dave