6 Replies Latest reply on Mar 30, 2016 3:29 PM by Peter Kahrel

    ScriptUI styles dropdown list : how to access to style groups?




      I'm trying to build an UI to select Table, Cell and Paragraph styles for further table processing (see my script below)


      So I used dropdown list menus for displaying styles. But I only got first level styles and not style groups and their contents.


      My question is : is it possible and how to get dropdown sub-menus to acces to styles groups and their contents?








      My javascript :


      //UI to select Table, Cell and Paragraph styles for further tables processing in a document


      myStyleChoices = myInput ();

      myTableStyle = myStyleChoices[0] ;

      myCellSTyle = myStyleChoices[1] ;

      myParStyle = myStyleChoices[2] ;



      function myInput ()


      var myParStylesList = app.activeDocument.paragraphStyles.everyItem().name

      var myCellStylesList = app.activeDocument.cellStyles.everyItem().name

      var myTableStylesList = app.activeDocument.tableStyles.everyItem().name


      var w = new Window ("dialog", "Apply to table :");


      var myInputGroup3 = w.add ("group");

      myInputGroup3.alignment = "left";

      myInputGroup3.add ("statictext", undefined, "Table style :");

      var myDropdown3 =myInputGroup3.add ("dropdownlist", undefined, myTableStylesList);

      myDropdown3.selection = 1 ;


      var myInputGroup2 = w.add ("group");

      myInputGroup2.alignment = "left";

      myInputGroup2.add ("statictext", undefined, "Cell style :");

      var myDropdown2 =myInputGroup2.add ("dropdownlist", undefined, myCellStylesList);

      myDropdown2.selection = 1 ;


      var myInputGroup1 = w.add ("group");

      myInputGroup1.add ("statictext", undefined, "Paragraph style :");

      myInputGroup1.alignment = "left";

      var myDropdown1 = myInputGroup1.add ("dropdownlist", undefined, myParStylesList);

      myDropdown1.selection = 1 ;


      var myButtonGroup = w.add ("group");

      myButtonGroup.alignment = "right";

      myButtonGroup.add ("button", undefined, "OK");

      myButtonGroup.add ("button", undefined, "Cancel");


      w.show ();


      r = [myDropdown3.selection.text , myDropdown2.selection.text , myDropdown1.selection.text] ;

      return r ;