Scripting the values in the selected dropdown menu
Sorry if this is basic, but I can't set the values of a currently selected dropdown menu based on an array described in a script.
I have been using a script that can create a new dropdown menu effect with the menu items I need to a layer named Control Centre:
thisComp=app.project.activeItem
var dropdownItems =
[
"East Midlands",
"East of England",
"Greater London",
"North East of England",
"North West of England",
"South East of England",
"South West of England",
"West Midlands",
"Yorkshire and the Humber",
"(-",
"England",
"Northern Ireland",
"Scotland",
"Wales",
"UK"
];
theLayer = thisComp.layer("Control Centre");
dropdownEffect = theLayer.property("ADBE Effect Parade").addProperty("ADBE Dropdown Control");
dropdownEffect.property(1).setPropertyParameters(dropdownItems);
The name of the new expressionscript menu effect that it creates is Dropdown Menu Control.
Because I have many dropdown menus in my current project with tens and sometimes hundreds of items, I would like to modify this script so that it changes the menu options of the currently selected named dropdown menu. Because I have other expressions which refer to specifically named dropdown menus.
I tried to parse the currently selected item to set the array using .isDropdownEffect, but although I have the effect selected when I run the following script, nothing happens:
var dropdownItems =
[
"Alex4D",
"East of England",
"Greater London",
"North East of England",
"North West of England",
"South East of England",
"South West of England",
"West Midlands",
"Yorkshire and the Humber",
"(-",
"England",
"Northern Ireland",
"Scotland",
"Wales",
"UK"
];
var props = app.project.activeItem.selectedProperties;
for (i=0; i<props.length; i++)
{
if (props[i].isDropdownEffect)
{
props[i].setPropertyParameters(dropdownItems)
}
}
Also, I would like to use prompt to enter the values as a comma-delimted string, but I can't paste values into the prompt field. How do I make it possible to use paste into a field in a prompt?
thisComp=app.project.activeItem
var theInput = prompt("Enter your , seprated array",0)
dropdownItems = theInput.split(",")
theLayer = thisComp.layer("Control Centre");
dropdownEffect = theLayer.property("ADBE Effect Parade").addProperty("ADBE Dropdown Control");
dropdownEffect.property(1).setPropertyParameters(dropdownItems);
Help will be recieved gratefully!
Alex4D
