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 button to change text with prompt toolkit

  • Adrián Wulfrath

    April 1, 2016 at 12:15 am

    Sooo can you share me an example for that??? plsssss

  • Dan Ebberts

    April 1, 2016 at 12:40 am

    Assuming you have given all your dropdowns unique names (like dd.name = “dd1”), I guess it would look like this:


    function updateProject(){
    switch (this.name){
    case "dd1":
    // do stuff for dropdown named "dd1"
    break;
    case "dd2":
    // do stuff for dropdown named "dd2"
    break;
    default:
    break;
    }
    }

    I haven’t tested any of this (I build my panels a different way), but it’s my best guess.

    Dan

  • Adrián Wulfrath

    April 1, 2016 at 1:14 am

    Something like this??????:

    //Creating My Window
    var myWin = new Window (“palette”,”Canal 5 Controles”,undefined,{resizeable: false , maximizeButton: false});
    myWin.orientation = “row”;

    var groupOne = myWin.add(“panel”,undefined,”MasterControles”);
    groupOne.orientation = “column”;
    groupOne.add (“iconbutton”,undefined,”~/Desktop/LogoC5Ctrl.png”,”https://www.google.com”)
    groupOne.add(“statictext”,undefined,”Primer Grupo”)
    var dd = groupOne.add(“dropdownlist”,undefined,[“OFF”,”Amarillo”,”Rojo”]);
    dd.selection = 0;
    groupOne.add(“checkbox”,undefined,”Caritas”);
    groupOne.add(“checkbox”,undefined,”Iconos”);

    //Action of my DropDownMenu
    dd.onChange = updateProject;

    function updateProject(){
    switch (this.name){
    case “dd1”:
    // do stuff for dropdown named “dd1”
    selection = 1
    app.project.item(7).layer(“_Control”).property(“Effects”).property(“Control v2”).property(“Color System”).setValue([1]);
    break;
    case “dd2”:
    // do stuff for dropdown named “dd2”
    selection = 2
    app.project.item(7).layer(“_Control”).property(“Effects”).property(“Control v2”).property(“Color System”).setValue([3]);
    break;
    default:
    break;
    }
    }

    myWin.center();
    myWin.show();

  • Adrián Wulfrath

    April 1, 2016 at 1:20 am

    I actually prove it but doesnt work, i dont know if i need something more or less. But how did you do your dropdown list ???

  • Dan Ebberts

    April 1, 2016 at 1:43 am

    >But how did you do your dropdown list ???

    I almost always use a resource string to build the entire palette/window.

  • Adrián Wulfrath

    April 1, 2016 at 1:48 am

    My Dropdown list is a Pseudo Effect inside a _Control Layer: Somethig like this:

    Layer: _Control
    Effect: Control v2
    Dropdownlist -> OFF
    Amarillo
    Rojo
    Morado

    And i want to connect from my Script depending of Selection to the Dropdown list of my Effect. Thats because im calling the app.project.item bla bla bla
    All i want to connect is that dropdown menu to my dropdownlist in my script window.

  • Adrián Wulfrath

    April 1, 2016 at 5:48 pm

    My Dropdown list is a Pseudo Effect inside a _Control Layer: Somethig like this:

    Layer: _Control
    Effect: Control v2
    Dropdownlist
    ->
    -OFF
    -Amarillo
    -Rojo
    -Morado

    And i want to connect from my Script depending of Selection to the Dropdown list of my Effect. Thats because im calling the app.project.item bla bla bla
    All i want to connect is that dropdown menu to my dropdownlist in my script window.

  • Adrián Wulfrath

    April 4, 2016 at 6:29 pm

    Hey Dan, thank you for all, i actually got it with this code:
    But do you know how to link the checkbox with an effect checkbox????

    //Creating My Window
    var myWin = new Window (“palette”,”Canal 5 Controles”,undefined,{resizeable: false , maximizeButton: false});
    myWin.orientation = “row”;

    var groupOne = myWin.add(“panel”,undefined,”MasterControles”);
    groupOne.orientation = “column”;
    groupOne.add (“iconbutton”,undefined,”~/Desktop/LogoC5Ctrl.png”,”https://www.google.com”)
    groupOne.add(“statictext”,undefined,”Primer Grupo”)
    var dd = groupOne.add(“dropdownlist”,undefined,[“OFF”,”Amarillo”,”Rojo”]);
    dd.selection = 0;
    groupOne.add(“checkbox”,undefined,”Caritas”);
    groupOne.add(“checkbox”,undefined,”Iconos”);

    dd.onChange = updateProject;
    //Action of my DropDownMenu
    function updateProject(){
    var dropSelection = dd.selection.text;

    switch (dropSelection){
    case “OFF”:
    // do stuff for dropdown named “dd1”
    alert(“blabla”);
    break;
    case “Amarillo”:
    // do stuff for dropdown named “dd2”
    alert(“jaja”);
    app.project.item(7).layer(“_Control”).property(“Effects”).property(“Control v2”).property(“Color System”).setValue([3]);
    break;
    case “Rojo”:
    // do stuff for dropdown named “dd2”
    alert(“Rojo”);
    app.project.item(7).layer(“_Control”).property(“Effects”).property(“Control v2”).property(“Color System”).setValue([3]);
    break;

    default:
    alert(“default”);
    break;
    }
    }

    myWin.center();
    myWin.show();

  • Dan Ebberts

    April 4, 2016 at 7:21 pm

    It’s very similar, except you would use onClick instead of onChange.

    var CB1 = groupOne.add(“checkbox”,undefined,”Caritas”);

    CB1.onClick = clickCB1;
    .
    .
    .
    .
    function clickCB1(){
    //set effect checkbox to same value as CB1
    }

    Dan

  • Adrián Wulfrath

    April 4, 2016 at 7:28 pm

    Thank you, really cool.

Page 2 of 2

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