Legend
December 13, 2025
Answered
How can this script read paragraph styles within the group?
- December 13, 2025
- 2 replies
- 1022 views
Currently, it can only read the external B1.
A1 and A2 are not recognized.
makeDialog();
//cs will hold the result
var cs, ps;
function makeDialog() {
//the dialog object
var theDialog = app.dialogs.add({ name: "Test ", canCancel: true });
//add a dropdown list object, stringList gets the name of every available character style
//note this would not get grouped styles
with (theDialog.dialogColumns.add()) {
staticTexts.add({ staticLabel: "UP: " });
staticTexts.add({ staticLabel: "Below: " });
staticTexts.add({ staticLabel: "Change: " });
}
//note this would not get grouped styles
with (theDialog.dialogColumns.add()) {
styleA = dropdowns.add({ stringList: app.activeDocument.paragraphStyles.everyItem().name, selectedIndex: 0, minWidth: 80 });
styleB = dropdowns.add({ stringList: app.activeDocument.paragraphStyles.everyItem().name, selectedIndex: 0, minWidth: 80 });
styleBN = dropdowns.add({ stringList: app.activeDocument.paragraphStyles.everyItem().name, selectedIndex: 0, minWidth: 80 });
}
if (theDialog.show() == true) {
//get the result
//cs = app.activeDocument.characterStyles.item(cs.selectedIndex);
styleA = app.activeDocument.paragraphStyles.item(styleA.selectedIndex);
styleB = app.activeDocument.paragraphStyles.item(styleB.selectedIndex);
styleBN = app.activeDocument.paragraphStyles.item(styleBN.selectedIndex);
theDialog.destroy();
}
}668.png
