5 Replies Latest reply on Jan 15, 2017 10:12 AM by Laubender

    Get information about Panels in Javascript

    cchimi Level 2

      I imagine if this were possible I'd have found some hint of it in my searches, but I wanted to check with the experts to make sure. It is possible to get information from ID's built-in panels to use in a Javascript? For instance, I'd like to let a user select pages in the Pages panel and then do something with them in my script. I see that the Library Panel has a selection object, but none of the other panels do. Is this feasible?

       

      Thanks!

        • 1. Re: Get information about Panels in Javascript
          Harbs. Level 6

          Nope. The panel scripting support is not that complete.

           

          Sorry...

          • 2. Re: Get information about Panels in Javascript
            cchimi Level 2

            Oh, well, at least I know I wasn't missing something obvious. Thanks!

            • 3. Re: Re: Get information about Panels in Javascript
              Laubender Adobe Community Professional & MVP

              Not exactly what you want, but the user could use the label feature for color labeling selected pages in the Pages Panel. But the user also have to provide you with the information what color the label is.

               

              You could provide a small GUI:

               

              1. A list with applied pageColor colors for all pages. The user has to select the applied page color.

              Now your script could search for that specific color and identify the pages.

               

              2. Button: Do something with the found pages.

              And reset the color of the found pages.

               

              Here some code for getting pageColor and sorting against a chosen one:

               

              //This will come from the GUI exposed to the user.
              //The user labeled the page and told you what color he used.
              
              var myChosenUIColor = UIColors.GREEN;
              
              var pagesWithSpecifiedLabel = new Array();
              var myPageColors = app.documents[0].pages.everyItem().pageColor;
              
              for(var n=0;n<myPageColors.length;n++){
                 
                  if(myPageColors[n] === myChosenUIColor){
                     
                      pagesWithSpecifiedLabel[pagesWithSpecifiedLabel.length++] = app.documents[0].pages[n];
                     
                      };
                 
                  };
              
              $.writeln(pagesWithSpecifiedLabel);
              

               

              Uwe

              • 4. Re: Re: Get information about Panels in Javascript
                cchimi Level 2

                Thanks for the idea. In this particular case I just wanted to extend some existing functionality by dropping an item into the Pages context menu (no point if I can't tell which pages are selected). But that could come in handy for a more focused task.

                • 5. Re: Get information about Panels in Javascript
                  Laubender Adobe Community Professional & MVP

                  Hi there,

                  I want to resurrect this old thread, because I found a trick to gain the information what document pages are selected in the Pages panel.
                  Perfectly—I think—for InDesign CS6 (selected master pages or selected document pages):

                   

                  4. Re: active page vs selected page

                  Uwe Laubender Jan 13, 2017

                  Re: active page vs selected page

                   

                  Not so for InDesign CC and above.

                  With newer versions I could only detect the selected document pages and the master spreads (not the individual master pages) that are selected in the Pages panel:

                   

                  6. Re: active page vs selected page

                  Uwe Laubender Jan 15, 2017

                  Re: active page vs selected page

                   

                  Please test and give feedback in the thread where I published the code.

                   

                  Thanks,

                  Uwe