2 Replies Latest reply on Aug 19, 2011 5:30 AM by CTC Imaging

    [JS][CS3] $ID/CellStylesPanelPopup (table...)

    CTC Imaging Level 1

      I have been struggling to access the "Select All Unused" menu from the Cell Styles Panel.

      But the panel does NOT exists!!!

      However there is a "$ID\CellStylesControlPanelPopup", but it stops at the 1st 10 entries and number 11 is the "Select All Unused"...

       

      Can anyone let me know the "name of the panel menu or popup?

      Same thing for the following Character & Paragraph Styles, but in this case the Panel itself.

      I prefer using names instead of indexes, in case they change between versions.

      app.panels[2].visible = true;     //*** OK
      app.panels.item("Character Styles").visible = true;     //*** ERROR

       

      Also what is the difference when using $ID??? Sometime the $ID won't work, especially multi words name.

      app.panels.item("Layers").visible = true;     //*** OK
      app.panels.item("$ID/Layers").visible = true;     //*** OK
      app.panels.item("Object Styles").visible = true;     //*** OK
      app.panels.item("$ID/Object Styles").visible = true;     //*** ERROR
      
      

       

      BACK to my ORIGINAL question...

      Can anyone let me know the name of the CELL or TABLE panel popup?

      And maybe can explain to me the naming logic? There is not much literature or list regarding menus.

      Thank you, Alex.

      Some code that works if you replace Cell with Object to access the later's submenu.

       var myMenu = app.menus.item("$ID/CellStylesPanelPopup");
       alert (myMenu.name);     //*** TEST
       var myMenuItem = myMenu.menuItems.item("Select All Unused");
       var myMenuAction = myMenuItem.associatedMenuAction;
       myMenuAction.invoke();
       var myAnswer = confirm ("Remove UNUSED Cell Styles? (Y/N)", false);
       if (myAnswer)
       {
        try
        {
         var myMenu = app.menus.item("$ID/CellStylesControlPanelPopup");
         var myMenuItem = myMenu.menuItems.item("Delete Style...");
         var myMenuAction = myMenuItem.associatedMenuAction;
         myMenuAction.invoke();
        }
        catch (e)
        {
         var myMenu = app.menus.item("$ID/CellStylesControlPanelPopup");
         var myMenuItem = myMenu.menuItems.item("Delete Styles...");
         var myMenuAction = myMenuItem.associatedMenuAction;
         myMenuAction.invoke();
        }
       }
      
        • 1. Re: [JS][CS3] $ID/CellStylesPanelPopup (table...)
          John Hawkinson Level 5
          Also what is the difference when using $ID??? Sometime the $ID won't work, especially multi words name.
          app.panels.item("Layers").visible = true;     //*** OK
          app.panels.item("$ID/Layers").visible = true;     //*** OK
          app.panels.item("Object Styles").visible = true;     //*** OK
          app.panels.item("$ID/Object Styles").visible = true;     //*** ERROR
          

          $ID names are locale-independent translation names. You can use app.findKeyStrings to determine what they are. E.g.:

           

          >> app.findKeyStrings("Object Styles")
          $ID/kSyncObjectStyleName,$ID/ObjStylesTreeViewPanelName,$ID/kObjectStyles
          
          

          Now, it's not 100% clear which one you should use. Probably $ID/ObjStylesTreeViewPanelName.

           

          Anyhow...

           

          app.panels[2].visible = true;     //*** OK
          app.panels.item("Character Styles").visible = true;     //*** ERROR

           

          Both of them work for me in CS5. Not sure why you see something different. 7.0.4.553.

           

          Can anyone let me know the name of the CELL or TABLE panel popup?

          We're talking about Table Styles? app.panels.item("Table Styles").visible=true; works fine for me.

           

          With respect to your first question, does this method help?

           

          app.menus.everyItem().name.sort().join("\n");
          ...
          Buttons Panel Menu
          Cell Styles Control Panel Menu
          Cell Styles Panel Context Menu
          Cell Styles Panel Menu
          Changes Info Panel Menu
          ...
          
          1 person found this helpful
          • 2. Re: [JS][CS3] $ID/CellStylesPanelPopup (table...)
            CTC Imaging Level 1

            I will study further more about the $ID. It looks like between revisions (CS3 --> CS5) the differential behavior w/ or w/o the $ID has been resolved.

             

            Regarding the original issue: Accessing The Cell Styles Panel submenu "Select All Unused". The same goes for the Table Styles.

            The goal is to delete all used Cell Styles same for the Table Styles. Viewing the panel is no problems, it works.

            Looking at the name of the panel (GUI), I was expecting "$ID/CellStylePanelPopup" to work.

            FYI, the Character Styles are located under "$ID/CharStylePanelPopup" and the Paragraph Styles are under "$ID/ParaStylePanelPopup".

            So the naming convention is a little astray.

             

            About the code, I left some old code that I was testing on a different action "Break Link to Style" which I found under "$ID/CellStylesControlPanelPopup".

            So here is the revised version

             app.panels.item("Cell Styles").visible = true;          //*** OK
             var myMenu = app.menus.item("$ID/CellStylesPanelPopup");
             alert (myMenu.name);          //*** ERROR
             var myMenuItem = myMenu.menuItems.item("Select All Unused");
             var myMenuAction = myMenuItem.associatedMenuAction;
             myMenuAction.invoke();
             var myAnswer = confirm ("Remove UNUSED Cell Styles? (Y/N)", false);
             if (myAnswer)
             {
              try
              {
               var myMenu = app.menus.item("$ID/CellStylesPanelPopup");
               var myMenuItem = myMenu.menuItems.item("Delete Style...");
               var myMenuAction = myMenuItem.associatedMenuAction;
               myMenuAction.invoke();
              }
              catch (e)
              {
               var myMenu = app.menus.item("$ID/CellStylesPanelPopup");
               var myMenuItem = myMenu.menuItems.item("Delete Styles...");
               var myMenuAction = myMenuItem.associatedMenuAction;
               myMenuAction.invoke();
              }
             }