4 Replies Latest reply on Nov 2, 2011 4:52 PM by Maria964

    Non Scripter lady needs a simple script to work with tabs...

    Maria964 Level 1

      I everybody! I know that I already should have learned Javascript. God knows that I realy tried but I could not cope with the job. So once again I have to ask my dear scripters to solve this for me!

      It goes like this: I am going to start the composition of a few books that have a lot of paragraphs with different tabs. They are so many that is really dificult to solve the problems with paragraph styles.

      What I need is a script that could mimic the operation of this two buttons that exist in MS Word

      IncreaseDecrease.PNG (Increase and Decrease the indent level of the paragraph [to the next or previous default tab already established in that paragraph style]).

      Can anyone help me?

      Thank you in advance,

      Maria

        • 1. Re: Non Scripter lady needs a simple script to work with tabs...
          John Hawkinson Level 5

          It's certainly doable.

           

          (Increase and Decrease the indent level of the paragraph [to the next or previous default tab already established in that paragraph style]).

           

          Do you really have irregular tabs? It would be much easier to have a script to just increase/decrease the left indent of a paragraph by a fixed amount.

           

          Yes, we can script looking up the tab stops of the paragraph, but it's a bit more effort. Plus, tab stops are relative to the left indent, so it becomes confusing to think about. I think the script would also need to change the tab stops to delete the leftmost tab stop at the same time as it increased the left indent.

           

          Is that what you mean? Can you confirm the exact set of steps to get this effect if you do it by hand?

          • 2. Re: Non Scripter lady needs a simple script to work with tabs...
            Maria964 Level 1

            Hi, John. Thank you again for helping me!

            What I need is a script that mimics the actions of the Indent and Outdent buttons that we use to write discussions on this forum and that is available in any word processor software: when I click Indent, the text moves to the right the amount that is defined by the next tab in the paragraph style.

            For exemple, in Indesign: one paragraph style has repeted left tabs at 10 mm. I apply the future script «Indent» and what I get in Indesign is 10 mm in the Left Indent and 0 in the First Line Left Indent.

            If I apply the future «Outdent script» now the paragraph reverts to the previous position (0, 0).

            The two scripts always work with the tabs that are already defined by the paragraph style that was already applied and it must not «change the tab stops to delete the leftmost tab stop at the same time as it increased the left indent».

            Please open MS Word, write some text, click in the Increase and Decrease Paragraph icons and see what happens. That is what I need.

            Thank for the time and for the trouble that I am giving you.

             

            Maria

            • 3. Re: Non Scripter lady needs a simple script to work with tabs...
              John Hawkinson Level 5

              Maybe I wasn't quite clear. Since tabs might not be repeated, making the script general enough to handle the case of say, tabs set at 10mm, 25mm, 31mm, 46mm, and 70mm might be somewhat difficult. But if we can assume they all go at repeated intervals (10mm, 20mm, 30mm, 40mm, 50mm, 60mm, 70mm), then it is much easier.

               

              Two scripts. Save as increaseIndent.jsx:

               

              app.selection[0].leftIndent+=app.selection[0].tabStops[0].position;
              

               

              And then decreaseIndent.jsx:

               

              app.selection[0].leftIndent-=app.selection[0].tabStops[0].position;
              

               

              It just increases or decreases the leftIndent of the current selection by the position of the first tab stop of that same selection.

              • 4. Re: Non Scripter lady needs a simple script to work with tabs...
                Maria964 Level 1

                Thank you John!

                It was precisely that.

                 

                Maria