-
Batch edit expressions with script
Hi,
I’m currently working on After Effects project with color preset options, which is basically a Layer Control that selects layer with Expression Controls and load its color values, sliders, etc.
This is the first expression I used:
comp("Main Comp").layer("Color Scheme").effect("Color Scheme Preset")("Layer").effect("Artist Color")("Color")
Though I realized later this expression will break if the layer control is select at any layer other than the one with correct color controls. I rewrite the first expression to try and catch (adapted from Dan’s reply: https://forums.creativecow.net/thread/227/26810), so if the layer control accidentally selects none or other layer, it will use the default color settings until the correct layer is selected.
try{
L = comp("Main Comp").layer("Color Scheme").effect("Color Scheme")("Layer");
prefix = L.effect("Artist Color")("Color");
}catch (err){
prefix = comp("Main Comp").layer("Preset 0 - Default").effect("Artist Color")("Color") ;
}
Unfortunately, I have around 50 project files to update to this new expression. I was wondering if batch editing expression is possible with scripting, to make the script reads the old expression, then use it as reference to write a new one.
Any feedback is appreciated.
Trirat

