var paraStyles = [];
var paraStylesID = [];
while (paraStyles.length > 0) paraStyles.pop();
while (paraStylesID.length > 0) paraStylesID.pop();
//~ while (paraStyles.length > 0) charStyles.pop();
//~ while (paraStylesID.length > 0) charStylesID.pop();
// Конечно, надо while (paraStyles.length > 0) paraStyles.pop();
var myParagraphStyles = app.activeDocument.allParagraphStyles;
var myParagraphStyleName, obj;
for (var i=0; i < myParagraphStyles.length ; i++) { // for
myParagraphStyleName = myParagraphStyles[i].name;
if (myParagraphStyleName[0] == "[") continue;
obj = myParagraphStyles[i];
while(obj.parent instanceof ParagraphStyleGroup) {
myParagraphStyleName = obj.parent.name + ":" + myParagraphStyleName;
obj = obj.parent;
}
paraStyles.push(myParagraphStyleName);
paraStylesID.push(myParagraphStyles[i].id);
} // for
///
var w = new Window("palette", "Paragraph Style:");
app.activate();
w.alignChildren = "left";
var byStyle = w.add("group");
byStyle.orientation = "column";
var FontDropdownGroup = byStyle.add("group");
var buttonGroup = byStyle.add("group");
button = buttonGroup.add("button", undefined, "W");
FontDropdownGroup.add("statictext", undefined, "Paragraph Style: ");
var letterParaStyle = FontDropdownGroup.add("dropdownlist", undefined, paraStyles);
letterParaStyle.selection = 0;
w.show()
///
button.onClick = function() {
var para_Index = letterParaStyle.selection.index;
var para_StyleID = paraStylesID[para_Index];
app.findGrepPreferences = app.changeGrepPreferences = null;
app.findGrepPreferences.appliedParagraphStyle = app.activeDocument.paragraphStyles.itemByID(Number(para_StyleID));
alert(para_StyleID);
app.activate();
}