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!
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
Copy link to clipboard
Copied
Hi Raphael,
Please find the below link:
Re: Create bullet paragraphstyle through indesign javascript
Thanks,
Prabu
Copy link to clipboard
Copied
But how does that change the bullet character to a dash?
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.
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
Copy link to clipboard
Copied
Thank you Akiva. This worked perfectly!