Copy link to clipboard
Copied
Hi, Ive found a code that will adjust a tab value, however it only adjusts the first entry. Is there a way to set the code on all tab characters? Thank you....
And directly to your scripting question:
You have to loop through all paragraphs in your selection. Because of:
var paragraph = app.selection[0].paragraphs[0];
will change only the first paragraph (that means the .paragraphs[0]) in your selection.
Hi,
Just adding the loop that will run on paragraph length.
var _paragraphs = app.selection[0].paragraphs;
for (var i = 0; i < _paragraphs.length; i++) {
paragraph = _paragraphs[i];
if (paragraph.tabStops.length == 1) {
paragraph.tabStops[0].properties =
{
alignment: TabStopAlignment.LEFT_ALIGN,
position: "0.125in"
};
};
if (paragraph.tabStops.length == 0) {
paragraph.tabStops.add
(
{
...
Copy link to clipboard
Copied
The easiest way for the future:
If you use a paragraph format, you no longer need the script. Just change the position of the tab stop in paragraph style.
Copy link to clipboard
Copied
And directly to your scripting question:
You have to loop through all paragraphs in your selection. Because of:
var paragraph = app.selection[0].paragraphs[0];
will change only the first paragraph (that means the .paragraphs[0]) in your selection.
Copy link to clipboard
Copied
How can I apply this loop? Im sorry, I know that this can be done using paragraph styles and tab settings, but what I want to do is include this tabstop to a number of commands on one script.
Copy link to clipboard
Copied
Hi,
Just adding the loop that will run on paragraph length.
var _paragraphs = app.selection[0].paragraphs;
for (var i = 0; i < _paragraphs.length; i++) {
paragraph = _paragraphs[i];
if (paragraph.tabStops.length == 1) {
paragraph.tabStops[0].properties =
{
alignment: TabStopAlignment.LEFT_ALIGN,
position: "0.125in"
};
};
if (paragraph.tabStops.length == 0) {
paragraph.tabStops.add
(
{
alignment: TabStopAlignment.LEFT_ALIGN,
position: "0.125in"
}
);
}
}
NOTE: Did not try at my end (Not tested)
Copy link to clipboard
Copied
Thank you so much @pixxxelschubser @Charu Rajput