Skip to main content
Inspiring
May 31, 2023 7:09 AM UTC
Answered

Need to change Case in basic character format of characterStyle to smallCaps using javascript

 

This topic is closed to new replies. Start a new post to keep the conversation going.
Karthik SGCorrect answer
Inspiring
May 31, 2023 9:22 AM UTC
var doc = app.activeDocument;
var characterStyle = doc.characterStyles.itemByName("ISmallcap");
if (characterStyle.isValid) {
  characterStyle.capitalization = Capitalization.SMALL_CAPS;
}

The oboce code works, just tried it, anyhow thanks for the response @Laubender 

3 replies

Community Expert
May 31, 2023 7:31 AM UTC

Hi @Karthik SG ,

the InDesign DOM documentation is your friend:

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

 

Regards,
Uwe Laubender
( Adobe Community Expert )

Translate
Inspiring
May 31, 2023 9:12 AM UTC

I tried , but I don't see that property, I can see only capitalization with small cap, so only i posted

var doc = app.activeDocument;
var charStyles = doc.characterStyles;
for (var i = 0; i < charStyles.length; i++) {
   $.writeln(charStyles[i].capitalization);
  //charStyles[i].capitalization = Capitalization.SMALL_CAPS;
}

I am trying to change "Case" in basic character formats from "openType All small Caps" to "Small Caps" of  particular characterStyle but i am unable to get it

Translate
Karthik SGAuthorCorrect answer
Inspiring
May 31, 2023 9:22 AM UTC
var doc = app.activeDocument;
var characterStyle = doc.characterStyles.itemByName("ISmallcap");
if (characterStyle.isValid) {
  characterStyle.capitalization = Capitalization.SMALL_CAPS;
}

The oboce code works, just tried it, anyhow thanks for the response @Laubender 

Translate