Code to be evaluated! [008] // Invert Para rule Indents! …


hi scripters,

 

this script inverts manual , para styles para rules indents (the para style(s) is(are) updated!).

 

it seems work find writing … ugly! no idea make more beautiful!

the first loop "for" inverts indents. second 1 updates para styles, according "if" statement.

 

 

app.doscript("main()", scriptlanguage.javascript, undefined, undomodes.fast_entire_script, "invert para rule indents! …");      function main()   {       var mydoc = app.activedocument;       var myparas = mydoc.stories.everyitem().paragraphs.everyitem().getelements();          (p = 0; p < myparas.length; p++)         {             var al = myparas[p].ruleaboveleftindent;             var ar = myparas[p].ruleaboverightindent;           var bl = myparas[p].rulebelowleftindent;             var br = myparas[p].rulebelowrightindent;           myparas[p].ruleaboveleftindent = ar;           myparas[p].ruleaboverightindent = al;           myparas[p].rulebelowleftindent = br;           myparas[p].rulebelowrightindent = bl;       }        (p = 0; p < myparas.length; p++)         {             var al = myparas[p].ruleaboveleftindent;         var ar = myparas[p].ruleaboverightindent;           var bl = myparas[p].rulebelowleftindent;             var br = myparas[p].rulebelowrightindent;                    var mystyle = myparas[p].appliedparagraphstyle;           var als = mystyle.ruleaboveleftindent;         var ars = mystyle.ruleaboverightindent;           var bls = mystyle.rulebelowleftindent;             var brs = mystyle.rulebelowrightindent;                  if ( al == ars && ar == als && bl == brs && br == bls ) {                 mystyle.ruleaboveleftindent = ars;                     mystyle.ruleaboverightindent = als;                     mystyle.rulebelowleftindent = brs;                     mystyle.rulebelowrightindent = bls;             }     }   } 

 

 

thanks in advance! 

 

(^/)

hi,

 

let me ask goal?

according code is:

1. inverse left/right indent of both rules of every paragraph found in doc

2. redefine applied parastyle if style not manually overriden

 

is correct?

 

jarek



More discussions in InDesign Scripting


adobe

Comments

Popular posts from this blog

Reader DC

AdobeIDの作り方

Adobe InDesign CC 2017 has stopped working