0 Replies Latest reply on May 28, 2016 9:10 AM by Obi-wan Kenobi

    Deplace paras per para styles …

    Obi-wan Kenobi Adobe Community Professional

      Hi all,

       

      I think about a script that works like this:

       

      I have 4 (or more) para styles applied to text.

       

      aaa (ParaStyle_1)

      bbb (ParaStyle_2)

      ccc (ParaStyle_1)

      ddd (ParaStyle_3)

      eee (ParaStyle_4)

      fff (ParaStyle_3)

      ggg (ParaStyle_1)

      hhh (ParaStyle_2)

      iii (ParaStyle_3)

      jjj (ParaStyle_4)

      kkk (ParaStyle_1)

      lll (ParaStyle_2)

      mmm (ParaStyle_3)

      nnn (ParaStyle_4)

       

      I would want to change the paras order as, e.g.:

       

      aaa (ParaStyle_1)

      ddd (ParaStyle_3)

      bbb (ParaStyle_2)

      eee (ParaStyle_4)

      ccc (ParaStyle_1)

      fff (ParaStyle_3)

      ggg (ParaStyle_1)

      iii (ParaStyle_3)

      hhh (ParaStyle_2)

      jjj (ParaStyle_4)

      kkk (ParaStyle_

      mmm (ParaStyle_3)

      lll (ParaStyle_2)

      nnn (ParaStyle_4)

       

      I mean (based on this list sample):

      When the script finds a para with ParaStyle_1 applied, it searches the first following para with ParaStyle_2 applied and "moves" this para just after the para with ParaStyle_1 applied first found.

      Then, when the script finds the following para with ParaStyle_1 applied, it searches the next following para with ParaStyle_2 applied and "moves" this para just after the para with ParaStyle_1 applied secondly found.

       

      It does the same thing for paras with ParaStyle_3 and _4 applied.

       

      So my question is:

      Defining 4 variables, one for each para with a para style applied.

      Playing 4 find/replace to collect each group of paras [so, 4 arrays with ParasStyle_1.Founds, ParasStyle_2.Founds, ParasStyle_3.Founds and ParasStyle_4.Founds].

       

      Can I manipulate the arrays content to "move" each item as I would like?

       

      [ I hope I'm clear!  , thanks in advance! ]