Page 1 of 1

How to check if an effect is missing

Posted: October 16th, 2015, 4:09 pm
by ernpchan
I need to generate a report for when effects are missing and I'm familiar with Paul's pt_EffectSearch 3 script but due to studio reasons I'm not able to purchase it. All I need is the ability to check if an effect is missing. I don't see anything in the CS6 scripting guide that checks for this. Is this do-able via javascript or is Paul using some voodoo magic that's only available via his script?

Re: How to check if an effect is missing

Posted: October 17th, 2015, 11:13 am
by beginUndoGroup
app.effects is an array of all available effects.
Each app.effects is an object {displayName:[string], matchName:[string]}.
I suppose that a missing effects won't be in that list.

You can also try to pick some AV Layer somewhere in the project and question myLayer.effect.canAddProperty(theEffectMatchName).

I both cases you'll need the matchName of the effect.

Re: How to check if an effect is missing

Posted: October 19th, 2015, 10:53 am
by ernpchan
Thanks beginUndoGroup but unfortunately that didn't work. When I load up a project that has a plugin that we don't have, app.effects contains the object for that missing fx so I if I check the effects that are on a layer against the names that are in app.effects my script reports that nothing is missing when we actually are.

Re: How to check if an effect is missing

Posted: October 19th, 2015, 12:46 pm
by Dan Ebberts
Based on my limited sample size, it appears that maybe missing effects show up in the list with the category blank. Would that help in your case?

Dan

Re: How to check if an effect is missing

Posted: October 19th, 2015, 5:04 pm
by ernpchan
What I ended up doing was writing out all the effects that app.effects returned to a text file. Then with my other script I read the contents of that text file to use as a baseline for what effects we have. What's a little odd is that if I load up a file that has effects that we don't have, clear the project and run the script that generates the text file, AE will still report back the missing plugins. So the key is to generate the text file with a completely clean launch of AE.

If there's a cleaner way of doing this I'd love to know it. For now this works for us.

Re: How to check if an effect is missing

Posted: October 22nd, 2015, 6:29 am
by beginUndoGroup
Yes you're right it doesnt work.
I also tried Dan's idea but there are many entries without a category in the app.effects array so it cannot be a test.
But it's possible to do it as you pointed out.
Maybe that info is hidding somewhere in the app.project.xmpPacket. Who knows.

Re: How to check if an effect is missing

Posted: November 26th, 2015, 1:28 am
by bkan
Try this, it is working for me :

function checkForInstalledEffect(matchName) {
var fx = app.effects, n, N=fx.length;
for (n=0; n<N; n++) if (fx[n].matchName === matchName) return true;
return false;
};

function applyEffectsAndSliders(effectMatchName){
app.beginUndoGroup("AK_toolbar");
var myCheck = checkForInstalledEffect(effectMatchName);
if(myCheck){
for(var i=0;i<app.project.activeItem.selectedLayers.length;i++){
var monCalque = app.project.activeItem.selectedLayers;
monCalque.Effects.addProperty(effectMatchName);
}
}
else{
alert("The effect name you typed in the settings does not exist. Please type another name.")
}
app.endUndoGroup();
}