Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
1

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

Contributor ,
Jul 16, 2023 Jul 16, 2023

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:

IMG_1675.jpeg


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

 

TOPICS
How to , Scripting
394
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 1 Correct answer

Community Expert , Jul 17, 2023 Jul 17, 2023

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

Translate
Contributor ,
Jul 17, 2023 Jul 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

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Jul 17, 2023 Jul 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

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Contributor ,
Jul 17, 2023 Jul 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!

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Jul 17, 2023 Jul 17, 2023

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

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Contributor ,
Jul 18, 2023 Jul 18, 2023
LATEST

Thanks @Manan Joshi! It worked just as expected 🙂

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines