Because allParagraphStyles returns an Array and not a Collection, you’ll have to capture the names via a loop.
Note that in your last post you are using paragraphStyles and not allParagraphStyles—they are very different.
Something like below, but I think you’ll run into a problem if there are same named styles, which is possible with multiple groups
makeDialog();
//global parameters for each stle and its name
var listA, styleA, listB, styleB, listBN, styleBN
//$.writeln("[" + psl + "]")
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()) {
//an array of style names for each dropown
listA = []
for (var i = 1; i < app.activeDocument.allParagraphStyles.length; i++){
listA.push(app.activeDocument.allParagraphStyles[i].name)
};
styleA = dropdowns.add({ stringList: listA, selectedIndex: 0, minWidth: 80 });
listB = []
for (var j = 1; j < app.activeDocument.allParagraphStyles.length; j++){
listB.push(app.activeDocument.allParagraphStyles[j].name)
};
styleB = dropdowns.add({ stringList: listB, selectedIndex: 0, minWidth: 80 });
listBN = []
for (var k = 1; k < app.activeDocument.allParagraphStyles.length; k++){
listBN.push(app.activeDocument.allParagraphStyles[k].name)
};
styleBN = dropdowns.add({ stringList: listBN, selectedIndex: 0, minWidth: 80 });
}
var res = theDialog.show();
if(res == true){
//get the name or each dropdow choice
styleA = listA[styleA.selectedIndex];
styleB = listB[styleB.selectedIndex];
styleBN = listBN[styleBN.selectedIndex];
main()
}else{
theDialog.destroy();
}
}
function main(){
alert("Selected Style Names:\r" + styleA + "\r"+ styleB + "\r"+ styleBN + "\r")
}
... View more