Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Forums Adobe After Effects Expressions Moving a property using script


  • Moving a property using script

  • marc lekanu

    December 24, 2022 at 10:20 pm

    Hello guys, I hope your doing well !


    var comp = app.project.activeItem;

    var ccc = comp.selectedLayers;


    app.beginUndoGroup(“Dernier Code”);

    ccc[0].property(“Contents”).property(1).selected = true;


    ccc[0].property(“Contents”).property(“Group 50”).selected = true;






    I have this script which copy and paste a property to a group. It work well if I only want to move a property. But when I use it in a loop to move like 20 – 30 property, after effects becomes extremely slow to a point where it becomes unusable.

    So, I’m searching for another way to move the property, does someone have an idea ?

    You can see in the picture below what I want to do, it’s only to move the property “10” to the group “Group 50”.

    Thank you

  • Dan Ebberts

    December 24, 2022 at 11:27 pm

    Have you considered using .moveTo() instead of executeCommand() ?

  • marc lekanu

    December 24, 2022 at 11:56 pm

    Yes, I’ve considered it.

    The .moveTo() method can only modify the index of the property.
    I can use it only with an integer for example :


    Something like that doesn’t work :

    var group50 = ccc[0].property(“Contents”).property(“Group 50”);


  • Dan Ebberts

    December 25, 2022 at 1:57 am

    Good point. Are you making sure in your loop that only the property you want to move is selected? It seems like you could get cascading mess if you’re not really tidy about that.

  • marc lekanu

    December 25, 2022 at 10:13 am

    You’ve made me realise that something was wrong with the loop.

    How the loop was working ?
    It selected one property, then copy it, then selected the group where I want to paste it, then past it.
    And it was looping 50 – 100 times, so it was extremely slow.

    But now all it’s fine, what the loop is doing ?
    It only selects all the properties.
    Then outside of the loop, the script copy the selected property in one go, then select the group, then past it.
    It is now very fast, the problem is resolved !

    Thank you very much Dan Ebberts, without you I don’t think that I would have realised the problem 😃

Viewing 1 - 5 of 5 posts

Log in to reply.

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