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?
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.
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:
And then decreaseIndent.jsx:
It just increases or decreases the leftIndent of the current selection by the position of the first tab stop of that same selection.
Thank you John!
It was precisely that.