How to check if an effect is missing

Find out why the . goes before the /

Moderator: Paul Tuersley

Post Reply
ernpchan
Posts: 56
Joined: February 8th, 2010, 11:27 pm

October 16th, 2015, 4:09 pm

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?
beginUndoGroup
Posts: 81
Joined: November 27th, 2012, 6:41 am

October 17th, 2015, 11:13 am

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.
ernpchan
Posts: 56
Joined: February 8th, 2010, 11:27 pm

October 19th, 2015, 10:53 am

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.
Dan Ebberts
Posts: 319
Joined: June 26th, 2004, 10:01 am
Location: Folsom, CA
Contact:

October 19th, 2015, 12:46 pm

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
ernpchan
Posts: 56
Joined: February 8th, 2010, 11:27 pm

October 19th, 2015, 5:04 pm

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.
beginUndoGroup
Posts: 81
Joined: November 27th, 2012, 6:41 am

October 22nd, 2015, 6:29 am

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.
bkan
Posts: 51
Joined: November 6th, 2013, 8:33 am

November 26th, 2015, 1:28 am

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();
}
Post Reply