Skip to main content
Known Participant
December 28, 2011
Answered

Turn on/off in the paragraph rules above/below

  • December 28, 2011
  • 1 reply
  • 1054 views

I have InDesign file which is having the Paragraph styles named Box1, Box2, Box3 etc., The Box1 output is Box with number 1 and the Box2 output is Box with number 2 etc.,

The Box style has many styles like paragraph rules below/above, character color etc., But inside the Box style options, always Paragraph Rules => Rule Above/Below options will be truned off. The reason is we apply the Box1 style for Chapter 1 indd files, Box2 style for Chapter 2 indd files etc.,

If I opened the Chapter 1 (25+ indd) files i should turn on the Paragraph rule above/below for Box1 (Box1=>Paragraph Rules=>Rule Above/Below), Chapter 2 i should turn on the Box2=>Paragraph Rules=>Rule Above/Below options etc.,

Chapter 1 (Opened 25+ files) => Box1 Style => Paragraph Rules => Turn on Rule Above/Below

Chapter 2 (Opened 25+ files) => Box2 Style => Paragraph Rules => Turn on Rule Above/Below

Chapter 3 (Opened 25+ files) => Box3 Style => Paragraph Rules => Turn on Rule Above/Below

.....

Thanks in Advance,

Thiru

This topic has been closed for replies.
Correct answer Prasath_Siva

Hi thiru

Chk this script and let me now any query.........

var openedDocs = app.documents;

//alert (openedDocs);

var myDocument = app.activeDocument;

var chapterPrefix = prompt ("Enter the paragraph style", "Box1", "TURN ON THE PARAGRAPH RULES");

for (var doc=0; doc<openedDocs.length; doc++){

//alert (doc);

var chapterPrefix1 = openedDocs[doc].paragraphStyles.item(chapterPrefix);

//alert (chapterPrefix);

if (chapterPrefix1.ruleAbove==true && chapterPrefix1.ruleBelow==true){

          //alert ("hh");

chapterPrefix1.ruleAbove=false;

chapterPrefix1.ruleBelow=false;

}

else {

//alert ("else");

chapterPrefix1.ruleAbove=true;

chapterPrefix1.ruleBelow=true;

          }

}

1 reply

Prasath_SivaCorrect answer
Participating Frequently
December 29, 2011

Hi thiru

Chk this script and let me now any query.........

var openedDocs = app.documents;

//alert (openedDocs);

var myDocument = app.activeDocument;

var chapterPrefix = prompt ("Enter the paragraph style", "Box1", "TURN ON THE PARAGRAPH RULES");

for (var doc=0; doc<openedDocs.length; doc++){

//alert (doc);

var chapterPrefix1 = openedDocs[doc].paragraphStyles.item(chapterPrefix);

//alert (chapterPrefix);

if (chapterPrefix1.ruleAbove==true && chapterPrefix1.ruleBelow==true){

          //alert ("hh");

chapterPrefix1.ruleAbove=false;

chapterPrefix1.ruleBelow=false;

}

else {

//alert ("else");

chapterPrefix1.ruleAbove=true;

chapterPrefix1.ruleBelow=true;

          }

}

mr_pathiAuthor
Known Participant
December 31, 2011

Hello prasath,

its working, thanks a lot..

thanks,

thiru