Skip to main content
Inspiring
July 17, 2023
Answered

Paragraph Style script: How to set tab stop position to the left margin?

  • July 17, 2023
  • 1 reply
  • 688 views

Hi all,

 

Does anyone know a script that creates a paragraph style and set the tab stop position to the left margin? Instead of using alignment options, I would to like to use the small triangles in the left corner as per the screenshot below:


I have found this code somewhere for the Tab stop position part:

tabStops.add({alignment: TabStopAlignment.CHARACTER_ALIGN, alignmentCharacter: ".", position: 4})

 

This may be a dumb question, but instead of "alignment", should I use "indent"?

 

Thanks in advance for the help! 🙂

Rogerio

 

This topic has been closed for replies.
Correct answer Manan Joshi

Hey @Manan Joshi, thanks for getting back to me 🙂 The only thing is that this tabStops code uses alignment options instead of the small triangles mentioned on this post. Could you please check? The Tabs panel in the "Bullets" style should match the screenshot above. Thx!


Try the following

var doc = app.activeDocument;
var a = doc.paragraphStyles.add({name:"Bullets", appliedFont:"Arial", fontStyle: "Regular", leftIndent: "0.25 in", pointSize:7, leading:10.5, bulletsAndNumberingListType: ListType.BULLET_LIST});
a.tabStops.add({alignment: TabStopAlignment.CHARACTER_ALIGN, alignmentCharacter: "."})

-Manan

1 reply

Inspiring
July 17, 2023

@Manan Joshi, the below script you shared on this post is exactly what I was looking for. Could you please adapt it as per my request above? 

var doc = app.activeDocument;

var a = doc.paragraphStyles.add({name:"Bullets", appliedFont:"Arial", fontStyle: "Regular", pointSize:7, leading:10.5, bulletsAndNumberingListType: ListType.BULLET_LIST});

a.tabStops.add({position:"0p6"})

 

Thanks in advance,
Rogerio

Community Expert
July 17, 2023

Hi @Rogerio5C09,

It seems you have found the code yourself. Does the following work for you

var doc = app.activeDocument;

var a = doc.paragraphStyles.add({name:"Bullets", appliedFont:"Arial", fontStyle: "Regular", pointSize:7, leading:10.5, bulletsAndNumberingListType: ListType.BULLET_LIST});

a.tabStops.add({alignment: TabStopAlignment.CHARACTER_ALIGN, alignmentCharacter: ".", position: 4})

Do mind to mention the unit in position as I have done in my original code else it will pick the unit set in the document i think

-Manan

-Manan
Inspiring
July 17, 2023

Hey @Manan Joshi, thanks for getting back to me 🙂 The only thing is that this tabStops code uses alignment options instead of the small triangles mentioned on this post. Could you please check? The Tabs panel in the "Bullets" style should match the screenshot above. Thx!