Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Activity Forums Adobe After Effects Expressions Extendscript naming Dropdown Menu effect

  • Extendscript naming Dropdown Menu effect

    Posted by Willem De rue on February 25, 2020 at 10:10 am

    Hello,

    I’m writing a simple script where I add a dropdown menu effect to a layer, but I can’t seem to rename the Dropdown Menu effect like with for instance a slider effect.


    var dropdownItems = [
    "Left",
    "Center",
    "Right"
    ];
    boxLayerDropdown = boxLayer.Effects.addProperty("ADBE Dropdown Control");
    boxLayerDropdown.property(1).setPropertyParameters(dropdownItems);
    boxLayerDropdown.name = "Align";

    What am I doing wrong here?

    Regards,

    Wim

    this throws “Object is invalid, while this is fine:


    boxLayerslider= boxLayer.Effects.addProperty("ADBE Slider Control");
    boxLayerslider.name = "Rounded corners";

    Brie Clayton replied 1 month ago 5 Members · 7 Replies
  • 7 Replies
  • Alex Munteanu

    February 25, 2020 at 8:04 pm

    I haven’t tested ‘Dropdown’ controls much.
    When I try to get their matchName they also showup as a Pseudo-effect, which is a bit weird.
    Anyways… what you could do instead is to rename the last added effect.

    boxLayer.Effects.property(boxLayer.Effects.numProperties).name = "Align";

  • Dan Ebberts

    February 25, 2020 at 8:13 pm

    The dropdown control is an unusual implementation. You could try this:


    var dropdownItems = [
    "Left",
    "Center",
    "Right"
    ];
    var boxLayerDropdown = boxLayer.Effects.addProperty("ADBE Dropdown Control");
    var temp = boxLayerDropdown.property(1).setPropertyParameters(dropdownItems);
    temp.propertyGroup(1).name = "Align";

    Dan

  • Willem De rue

    February 27, 2020 at 8:43 am

    Thanks Dan, that did the trick (of course)!

  • Fede Parodi

    December 23, 2024 at 1:36 pm

    Hi, I have a similar situation. In my case, I would like to be able to change the active item in the dropdown menu.

    I guess it would be something like this:

    var dropdownItems = [

    “Left”,

    “Center”,

    “Right”

    ];

    var boxLayerDropdown = boxLayer.Effects.addProperty(“ADBE Dropdown Control”);

    var temp = boxLayerDropdown.property(1).setPropertyParameters(dropdownItems);

    temp.propertyGroup(1).name = “Align”;

    temp.propertyGroup(1).setValue(1); // Here I want to set a default value at “Center” but it’s not working.

    Do you know how can I change the values of a dropdown menu?

  • Dan Ebberts

    December 23, 2024 at 2:56 pm

    I’m not sure this is what you’re asking, but it appears that setting the parameter list invalidates your object reference, so to change the selection afterwards, you need to re-establish the reference with a full property spec path, like this:

    boxLayer.property("Effects").property("Dropdown Menu Control").property(1).setValue(2);
  • Fede Parodi

    December 23, 2024 at 10:01 pm

    Thanks a lot Dan! That solved it

  • Brie Clayton

    December 24, 2024 at 3:59 pm

    Thank you for solving this, Dan!

We use anonymous cookies to give you the best experience we can.
Our Privacy policy | GDPR Policy