1 Reply Latest reply on Oct 19, 2017 5:33 AM by itsBenMason

    Create Swatchlegend from Swatches that is being used in group

    andersn60104161

      I wonder if anybody have any ideas how to generate a Swatch legend of swatches that are used in a selected group?

      I found following thread but the solution in this generates a swatch legend based on the swatch palette.

      Re: Scripting - Add Swatches

       

      Thanks for help!

        • 1. Re: Create Swatchlegend from Swatches that is being used in group
          itsBenMason Level 2

          If you are doing a batch script best way is to make a temp path with stroke and fill colour of current colour then loop over each colour and doing both:

          app.executeMenuCommand("Find Stroke Color menu item");
          app.executeMenuCommand("Find Fill Color menu item");
          

          then checking document selection to see if there is more than 1 (or 2 sometimes not too sure why there is sometimes 2 even though it isn't used elsewhere).

          If you find its being used: store colour then loop over the list of colours drawing as u go

           

          If your are opening the document and then running the script you could just go to the swatches panel, click the options drop down top right and select unused colours -> drag to bin then run the script afterwards. That way you the only swatches it will be drawing are only the swatches currently in the document