Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Activity Forums Adobe After Effects Expressions How to create a DropDownList to change a Panel inside the same Panel???

  • How to create a DropDownList to change a Panel inside the same Panel???

    Posted by Adrián Wulfrath on April 4, 2016 at 9:53 pm

    All i want is to do something like the Figure 1, 2 & 3. Just the PANEL Dropdownlist.
    If someone can share some code with 3 different panels that function with a dropdownlist pls share with us. Thank you in advance.

    Adrián Wulfrath replied 10 years, 1 month ago 3 Members · 4 Replies
  • 4 Replies
  • Miguel De mendoza

    April 4, 2016 at 10:17 pm

    It looks that is a lot of workarround on this question, i can recomend to you this links:

    -Must-see workshop: https://www.provideocoalition.com/after-effects-extendscript-training-complete-series/

    -The nightstand book : https://blogs.adobe.com/aftereffects/files/2012/06/After-Effects-CS6-Scripting-Guide.pdf?file=2012/06/After-Effects-CS6-Scripting-Guide.pdf

    I hope it helps

  • Jakob Wagner

    April 5, 2016 at 11:47 am

    Hi

    I don’t have a full code, but maybe this will help you.
    I would create three different panels, within the one.
    Something like this. “pal” is the base of your panel, how you get that is depending on how your script is put together:


    //Subpanels:
    var panel1 = pal.add("panel", [x, y, x+width, y+height], "panel1");
    var panel2 = pal.add("panel", [x, y, x+width, y+height], "panel2");

    //Add dropdown:
    var dropdown = pal.add("dropDownList", [x, y, x+width, y+height], ["label1", "label2"]);

    //Add event handler for dropdown:
    dropdown.onChange = function()
    {
    switch(dropdown.selection.text)
    {
    case "label1":
    panel1.visible = true;
    panel2.visible = false;
    break;
    case "label2":
    panel1.visible = false;
    panel2.visible = true;
    break;
    }
    }

    Code is untested, but should be about right.

    – Jakob Wagner

  • Adrián Wulfrath

    April 5, 2016 at 4:03 pm

    Well here is my Panel Code, and i have problems to run the URL script so where i put that code???? Can you help me please?, and why if i call a variable from the panel group doesnt work like the Window functions??. Windows and Panels doesnt work with the same script structure…

    //Explorer Voraz Button
    var winBrowserCmd = "C:/Program Files/Internet Explorer/iexplore.exe";
    var macBrowserCmdStart = "osascript -e 'open location \"";
    var macBrowserCmdEnd = "\"'";

    {
    function myScript(thisObj){
    function myScript_buildUI(thisObj){
    var myPanel = (thisObj instanceof Panel) ? thisObj : new Window("palette","My Window name",undefined,{resizable:true});

    res = "group{orientation:'row',\
    groupTwo: Group{orientation:'column',\
    myIconButton: IconButton{text:'IconButton', image:'~/Desktop/LogoC5Ctrl.png'},\
    myStaticText: StaticText{text:'Este es mi texto /n dfgdf'},\
    },\
    groupOne: Panel{text:'Master', orientation:'column',alignment:['fill','fill'],alignChildren:['fill','fill'],\
    myCheckbox: Checkbox{text:'My Checkbox'},\
    myDropDownList: DropDownList{properties:{items:['Amarillo','Morado','LightBlue','MidBlue']}},\
    },\
    }";

    myPanel.grp = myPanel.add(res);

    //Defaults
    myPanel.grp.groupOne.myDropDownList.selection = 0

    myPanel.grp.groupTwo.myIconButton.onClick = LinkToURL;

    myPanel.layout.layout(true);

    return myPanel;

    }

    function LinkToURL()
    {
    //Action to link Voraz OnClick
    BtnURL.onClick = LinkToURL;

    function LinkToURL()
    {
    var URL = "https://www.estudiovoraz.com"; // your web page
    if ($.os.indexOf("Windows") != -1)
    system.callSystem(winBrowserCmd + " " + URL);
    else
    system.callSystem(macBrowserCmdStart + URL + macBrowserCmdEnd);

    }

    }

    var myScriptPal = myScript_buildUI(thisObj);

    if((myScriptPal != null) && (myScriptPal instanceof Window)){
    myScriptPal.center();
    myScriptPal.show();
    }

    }

    myScript(this);
    }

  • Adrián Wulfrath

    April 5, 2016 at 4:33 pm

    Hey i actually got it, thank you very much, but the last thing is how can i call an URL when i click to my IconButton????

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