Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Activity Forums Adobe After Effects Expressions find words in the expression box

  • find words in the expression box

    Posted by Rainier Raydán on June 17, 2017 at 10:03 pm

    Hi. I have an array [“app”, “project”] and I want to find any of those words in a string “app.project.item(2).layer(“Dark Gray Solid 3”).property(“ADBE Transform Group”).property(“ADBE Rotate Z”)”

    I found this match(/\b**insert the word**\b/); but I just cant put a variable on it… I’ve try to set a for() loop so it can look for all the words of the array on the string but I dont know how to do it…

    Rainier Raydán replied 8 years, 11 months ago 1 Member · 1 Reply
  • 1 Reply
  • Rainier Raydán

    June 19, 2017 at 11:39 pm

    So I found the split function to split a string in words and make an arry, that way I can just search for a match and in return I get the curLayer. I’ve use an if(curProp.expressionEnable == true){ exprAry.push(curProp)} so the loop only gets the expressions that are enabled. But for some reason it also gets some of the expressions box that are disabled… when I search for “color” it also gets me all the layers that have a fill color or a color picker…

    This is my script:

    var proj = app.project;

    app.beginUndoGroup("undo");
    var exprAry = new Array();

    for(i=1;i<=proj.numItems;i++){
    var curItem = proj.item(i);
    if(curItem instanceof CompItem){
    for(q=1;q<=curItem.numLayers;q++){
    var curLayer = curItem.layer(q);
    for(w=1;w<=curLayer.numProperties;w++){
    var curProp1 = curLayer.property(w);
    for(e=1;e<=curProp1.numProperties;e++){
    var curProp2 = curProp1.property(e);
    if(curProp2.expressionEnabled == true){
    exprAry.push(getWords (curProp2));
    }
    for(a=1;a<=curProp2.numProperties;a++){
    var curProp3 = curProp2.property(a);
    if(curProp3.expressionEnabled == true){
    exprAry.push(getWords (curProp3));
    }
    for(s=1;s<=curProp3.numProperties;s++){
    var curProp4 = curProp3.property(s);
    if(curProp4.expressionEnabled == true){
    exprAry.push(getWords (curProp4));
    }
    }
    }
    }
    }
    for(m=0;m

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