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

setting a custom bullet

Explorer ,
Jun 19, 2019 Jun 19, 2019

I am trying to create a simple script that creates all the styles in a document for a specific client. I am trying to get one of the styles to have a dash as a bullet rather than a · symbol. This is my current code:

newStyle=app.activeDocument.paragraphStyles.add();

newStyle.name="inspirational source";

newStyle.basedOn=app.activeDocument.paragraphStyles.itemByName("inspirational first");

newStyle.justification =Justification.LEFT_ALIGN;

newStyle.keepWithPrevious=true;      

newStyle.hyphenation=false;

newStyle.balanceRaggedLines=BalanceLinesStyle.VEE_SHAPE;

newStyle.spaceBefore = "0";

newStyle.fontStyle = "Medium";

newStyle.leftIndent = myLeading *3;

newStyle.bulletsAndNumberingListType=ListType.BULLET_LIST;

newStyle.preferences.bullet.characterValue=\u2013;

newStyle.firstLineIndent=-5;

newStyle.lastLineIndent=0;

The code is giving me an error on line 12.

I am very new to scripting but I am hoping that by playing with this kind of code, I will start to understand how the scripting model works so any help is much appreciated!

TOPICS
Scripting
1.4K
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

Explorer , Jun 19, 2019 Jun 19, 2019

newStyle.bulletsAndNumberingListType=ListType.BULLET_LIST; 

newStyle.bulletChar.characterType= BulletCharacterType.UNICODE_ONLY;

newStyle.bulletChar.characterValue=8211;  // needs to be a Decimal Long int.l 2013 hex in decimal is 8211

Translate
Engaged ,
Jun 19, 2019 Jun 19, 2019

Hi Raphael,

Please find the below link:

Re: Create bullet paragraphstyle through indesign javascript

Thanks,

Prabu

Thanks,
Prabu
Design smarter, faster, and bolder with InDesign scripting.
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
Explorer ,
Jun 19, 2019 Jun 19, 2019

But how does that change the bullet character to a dash?

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
Participant ,
Jun 19, 2019 Jun 19, 2019

Reference link:

https://www.indesignjs.de/extendscriptAPI/indesign-latest/#Bullet.html

Have you tried setting the characterType before the characterValue? Just an idea.

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
Explorer ,
Jun 19, 2019 Jun 19, 2019

newStyle.bulletsAndNumberingListType=ListType.BULLET_LIST; 

newStyle.bulletChar.characterType= BulletCharacterType.UNICODE_ONLY;

newStyle.bulletChar.characterValue=8211;  // needs to be a Decimal Long int.l 2013 hex in decimal is 8211

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
Explorer ,
Jun 19, 2019 Jun 19, 2019
LATEST

Thank you Akiva. This worked perfectly!

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