Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Activity Forums Adobe After Effects Expressions Adding selected item in project panel to a comp

  • Dan Ebberts

    August 17, 2013 at 4:09 pm

    Something like this:

    var myComp = app.project.activeItem;


    var myComp = app.project.activeItem;

    for(var i = 1; i <= app.project.numItems; i++){
    if ((app.project.item(i) instanceof FootageItem) && app.project.item(i).selected){
    myComp.layers.add(app.project.item(i));
    }
    }

    Dan

  • Shahrokh Jahanzadeh

    August 18, 2013 at 4:39 am

    Thanks Dan.

    this code worked perfectly but there is a new problem…

    your codes worked when we selected Comp panel or timeline panel
    and when I added this new line in top, it didn`t work because the project panel will select.
    app.project.importFileWithDialog();

    How we can fix it?

    Shahrokh

  • Dan Ebberts

    August 18, 2013 at 5:48 am

    Did you try making your new line the second line? If that won’t work for you, I guess you’ll have to go through the project bin and find your comp by name.

  • Shahrokh Jahanzadeh

    August 18, 2013 at 5:56 am

    Oh my GOD…
    No I didn`t try, I really forgot this one…
    that way worked perfectly
    You are the BEST

    thanks Dan

    Shahrokh

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