Hi have a dropdownlist that takes its content from a users layer selection in the timeline when the script is run. However, I'd like the dropdownlist to update if the user makes a new selection.ie. The user has layers 1. 2, 3, 4 selected and runs the script. After running the script they change the selection to just 2, 4. Can I script this to update automatictally? Failing that could create a button to reset the dropdown list?
Here are the relevent bits of my code.
//create variable and extract .name property. Place in selectionNames variable
var userSelection = app.project.activeItem.selectedLayers;
var selectionNames = [];
for (var j=0; j<userSelection.length; j++) selectionNames[j] = userSelection[j].name;
//average is added to all selectedLayers
selectionNames.push("Average");
myDropDownList:DropDownList{properties:{items:" + selectionNames.toSource() + "}}\
//loads dropdownlist selection into variable after user selection
var num = 0;
myScriptPal.grp.groupOne.myPanelTwo.myDropDownList.onChange = function () {
var ddListSelection = myScriptPal.grp.groupOne.myPanelTwo.myDropDownList.selection
alert (ddListSelection.index);
alert (userSelection[ddListSelection.index].position.value[dimension]);
num = userSelection[ddListSelection.index].position.value[dimension];
}
I can post more of my script if this doesn't make thing clear.