• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
98

Ability to read text values of dropdowns in expressions

Explorer ,
Sep 28, 2022 Sep 28, 2022

Copy link to clipboard

Copied

It's pretty cumbersome to have expressions work with dropdowns because currently you can only get the number value of a dropdown. Here's an example:

if (thisEffect("dropdown").value == 1) value = 13;
else if (thisEffect("dropdown").value == 2) value = 50;
else if (thisEffect("dropdown").value == 3) value = 100;

Now let's say you use the dropdown to control 12 properties. Then you make some mistake or you decide to change the values of this dropdown. Have fun.

SOLUTION

A solution would be to have a .textValue property of dropdowns. Here's how that would work with the example:

if (thisEffect("dropdown").textValue == "Style 1") value = 13;
else if (thisEffect("dropdown").textValue == "Style 2") value = 50
else if (thisEffect("dropdown").textValue == "Style 3") value = 100

Now the code is a LOT more readable and easier to work with.
Idea No status

Views

1.6K

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
14 Comments
New Here ,
Sep 28, 2022 Sep 28, 2022

Copy link to clipboard

Copied

I totally agree with the simplicity of this code and am in dire need of the ability to access the field name, but depending on the backend code of how this expression module was built maybe it still needs the index value from the module so - thisEffect("dropdown").value.text - might be a viable solution also. Although I like the cleanliness of the textValue solution proposed.

Votes

Translate

Translate

Report

Report
Community Beginner ,
Sep 28, 2022 Sep 28, 2022

Copy link to clipboard

Copied

I realized this limitation of this new feature as soon as it came out and couldn't believe it.

I am in a situation now where I have ~40 city names that I'd LOVE to be able to list in the dropdown menu for use in a mogrt. The list selection would trigger the apporopriate city picture to appear and life would be good. Ideally that code would look something like this (in the opacity layer):

cityA = layer("City Select").effect("Dropdown Menu Control")("Menu").textValue;
cityB = thisLayer.name;

if (cityA == cityB) {
100
} else {
0
}

INSTEAD I'd have to create 40 variables tying index values to each city name or rely on the layer indexes lining up exactly with the dropdown indexes etc. The ability to access the string values associated with the dropdown menu would allow for much simpler and more flexible coding.

In regard to the textValue solution, an alternative could be calling to the array i.e. effect("Dropdown Menu").value[0] to call to the index and .value[1] to call to the name/string.

Votes

Translate

Translate

Report

Report
Community Beginner ,
Sep 28, 2022 Sep 28, 2022

Copy link to clipboard

Copied

An even simpler example.

I want to put some text in a graphic template from a pre-defined list. Currently I would have to set up the dropdown list, then create that same list again in my expressions just to get the text again. If I can access the text value, then I could set that text directly and it would also update if I change the list.

For that matter, I could also call up a logo to match it by referencing the logo's layer name and checking if it matches the dropdown value. That also would easily copy and paste onto new layers with the same expression, and allow modifying the list without breaking anything.

Getting the item name from the dropdown is at least as useful as the index number.

Votes

Translate

Translate

Report

Report
Explorer ,
Sep 28, 2022 Sep 28, 2022

Copy link to clipboard

Copied

Making MOGRTS with calendar-like entries where there are drop-downs for Month and DayOfWeek which I have to populate with values for the human to read; but then I have to re-supply values in the code for the expression to use:

Months = ["January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"];
Months[effect("Month Name")("Menu") - 1];

I'm good with .textValue or whatever works besides having to make this entry twice. Thanks for considering!

Votes

Translate

Translate

Report

Report
New Here ,
Sep 28, 2022 Sep 28, 2022

Copy link to clipboard

Copied

the acces to the "textValue" of a dropdownmenu would definitely be a big help.
For now, I'm afraid it will be the retyping of the list...

Votes

Translate

Translate

Report

Report
New Here ,
Sep 28, 2022 Sep 28, 2022

Copy link to clipboard

Copied

Okay, so if you reference this article (https://helpx.adobe.com/after-effects/using/create_dropdowns_using_expressions.html) there is supposedly a way to set the dropdown list array through an expression. This could possibly solve the problem, because you should be able to link to external values within the expression, so you set the "dropdown item#1" value in a given location (which you link to through the expression) and you could then call on that string in other locations, as well as have it update in the dropdown list itself. The problem is, this example, Dropdowneffect = Dropdowneffect.setPropertyParameters(["Monday", "Wednesday", "Friday", "Sunday"]); does not work as described. It says right in the article, "The above statement will edit the dropdown menu to have Monday, Wednesday, Friday, Sunday as the items. The returned property is the updated one and should be used for all further uses." But when you use this, it does not work. Can someone explain how this is meant to work, as it may be a workaround for the time being, or until the textValue option becomes a thing.

Votes

Translate

Translate

Report

Report
Explorer ,
Sep 28, 2022 Sep 28, 2022

Copy link to clipboard

Copied

@Seth - the reason that method doesn't work with Expressions is because it is meant for Scripting via Extendscript - it says in the paragraph headline "Scripting support for Dropdown Menu Control"

While there are many similarities between Scripting and Expressions, there are many things that are unavailable or not fully exposed to the realm of Expressions. Such as setting properties this way, unfortunately!

Votes

Translate

Translate

Report

Report
New Here ,
Sep 28, 2022 Sep 28, 2022

Copy link to clipboard

Copied

@florian - Thanks for the response, and for helping to clarify why this isn't working. I am no coder, and just dabbling in expressions, so I assumed I was missing something. Clearly I was, so thanks for the heads up! Cheers!

Votes

Translate

Translate

Report

Report
New Here ,
Sep 28, 2022 Sep 28, 2022

Copy link to clipboard

Copied

This is a great idea!

Votes

Translate

Translate

Report

Report
Enthusiast ,
Sep 28, 2022 Sep 28, 2022

Copy link to clipboard

Copied

To clarify/correct Seth Jansen's earlier comment, Dropdowneffect.setPropertyParameters() is a scripting function, not an expressions language function.

Votes

Translate

Translate

Report

Report
Participant ,
Sep 28, 2022 Sep 28, 2022

Copy link to clipboard

Copied

I second this.

Votes

Translate

Translate

Report

Report
New Here ,
Sep 28, 2022 Sep 28, 2022

Copy link to clipboard

Copied

This would solve a big headache for me I'm currently facing! Would be overall very helpful in scripting and layer control.

Votes

Translate

Translate

Report

Report
Contributor ,
Nov 28, 2022 Nov 28, 2022

Copy link to clipboard

Copied

Hi, I would like to be able to get a text value from the Dropdown menu list, besides its numeric value.
This will add more features for automating and writing expressions via the API.
For expressions, it would also be useful

Votes

Translate

Translate

Report

Report
Explorer ,
Nov 01, 2023 Nov 01, 2023

Copy link to clipboard

Copied

LATEST

I wasted hours thinking I'm not suure what I'm doing only to find out it's not even possible. Such basic feature should have been there 10 years ago at least

Votes

Translate

Translate

Report

Report