-
Need Script help – How to remove string from condition
For simplicity 1st, heres the issue I have but with 2 lines:
I have something like this:
var a = app.project.activeItem."numLayer"
alert(a);theres the string quotation marks causing the error, how do I remove it so that it can work?
——————–
the full script I have atm is this
its a script that gets the full path of the selected Property and tries to insert an expression into it
will need it as this will go into a bigger script where if you have several selected layers, you can apply the expressions to all of them with this selected property without digging through the layers.var comp = app.project.activeItem;
var selProp = comp.selectedProperties;
var selLay = comp.selectedLayers;
var curProp = selProp[1];
var ary = [];
if(comp.selectedProperties == null || comp.selectedProperties!== PropertyType.INDEXED_GROUP){
alert("Select an Effect Property");
}else{
while (curProp.parentProperty !== null){
ary.push(".property(\""+curProp.name+"\")");
curProp = curProp.parentProperty;
}
}
var lay = comp.layer("\""+selLay[0].name+"\"")+ary.reverse().join("");
lay.expression = "test"; //PROBLEMATIC
}
when executed, var lay can’t give the expression because of the quotation marks, theres why I have issueso far
function looseJsonParse(obj){
return Function('"use strict";return (' + obj + ')')();
isn’t helping and idk if i should use eval()?