2 Replies Latest reply on Mar 27, 2014 2:28 PM by brendanT

    adding name to drop down lists for user

    brendanT Level 1

      I'm trying to wrap  my head around scripting and am having some problems with dropdown lists.Here is my code thus far.


      var userSelection = app.project.activeItem.selectedLayers;

      alert (userSelection[0].name)

      var myWin = new Window("palette", "My Window", undefined);
      myWin.orientation = "row";

      var groupOne = myWin.add("group", undefined, "GroupOne");
      groupOne.orientation = "column";
      var dd = groupOne.add("dropdownlist", undefined, userSelection);
      dd.selection = 1;

      var groupTwo = myWin.add("group", undefined, "GroupOne");
      groupTwo.orientation = "row";

      groupTwo.add("statictext", undefined, "move layer by:");
      groupTwo.add("edittext", [0,0,100,20], "");
      groupTwo.add("statictext", undefined, "pixels");
      groupTwo.add("button", undefined, "Execute");




      My dropdown list gives the right number of items but they are all referred to as [avlayer object]. I tied adding userSelection.name but that doesn't work since I need to use the index of the array to retrieve that property. So how to I go about populating a drop down box with the names of the items selected by the user?