0 Replies Latest reply on Nov 8, 2012 8:08 AM by rajnikids

    select items using swatches in drop down list

    rajnikids Level 1

      Hi,

       

      Its a script for : selecting swatches in a dropdown list;;;

       

      Could anybody help on this,

       

       

      i need to select the strokes, fill colours of particular applied swach, using the same swatch name displying inside the dropdown list.

       

      the scrip is.........

       

       

      swatchSelect();

      02

       

      03

      if (myReturn) {

      04

           alert("You selected " + app.activeDocument.swatches[mySwatchesResult].name);

      05

      }else {

      06

           alert("You canceled dialog.");

      07

      }

      08

       

      09

      function swatchSelect(){

      10

         with(myDialog = app.dialogs.add({name:"Swatches in the active document"})){

      11

            myDialogColumn = dialogColumns.add();

      12

            with(myDialogColumn){

      13

               with(borderPanels.add()){

      14

               staticTexts.add({staticLabel:"Swatches "});

      15

               mySwatches = app.activeDocument.swatches;

      16

                  myDropdown = dropdowns.add();

      17

                  myDropdown.stringList = mySwatches.everyItem().name;

      18

                  myDropdown.selectedIndex = 0;

      19

               }

      20

            }

      21

            myReturn = myDialog.show();

      22

            if (myReturn == true){

      23

               mySwatchesResult = myDropdown.selectedIndex;

      24

               myDialog.destroy;

      25

               return mySwatchesResult;

      26

            } else {

      27

               myDialog.destroy();

      28

            }

      29

         }

      30

      }