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

setting a custom bullet

Explorer ,
Jun 19, 2019 Jun 19, 2019

Copy link to clipboard

Copied

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

Views

807

Translate

Translate

Report

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

Votes

Translate

Translate
Engaged ,
Jun 19, 2019 Jun 19, 2019

Copy link to clipboard

Copied

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.

Votes

Translate

Translate

Report

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

Copy link to clipboard

Copied

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

Votes

Translate

Translate

Report

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

Copy link to clipboard

Copied

Reference link:

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

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

Votes

Translate

Translate

Report

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

Copy link to clipboard

Copied

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

Votes

Translate

Translate

Report

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

Copy link to clipboard

Copied

LATEST

Thank you Akiva. This worked perfectly!

Votes

Translate

Translate

Report

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