Expressions/Scripts/Presets

Moderator: Paul Tuersley

 
ernpchan
Topic Author
Posts: 56
Joined: Mon Feb 08, 2010 11:27 pm

How to check if an effect is missing

Fri Oct 16, 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: 77
Joined: Tue Nov 27, 2012 6:41 am

Re: How to check if an effect is missing

Sat Oct 17, 2015 11:13 am

app.effects is an array of all available effects.
Each app.effects[i] 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
Topic Author
Posts: 56
Joined: Mon Feb 08, 2010 11:27 pm

Re: How to check if an effect is missing

Mon Oct 19, 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: 318
Joined: Sat Jun 26, 2004 10:01 am
Location: Folsom, CA
Contact:

Re: How to check if an effect is missing

Mon Oct 19, 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
Topic Author
Posts: 56
Joined: Mon Feb 08, 2010 11:27 pm

Re: How to check if an effect is missing

Mon Oct 19, 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: 77
Joined: Tue Nov 27, 2012 6:41 am

Re: How to check if an effect is missing

Thu Oct 22, 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: Wed Nov 06, 2013 8:33 am

Re: How to check if an effect is missing

Thu Nov 26, 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[i];
monCalque.Effects.addProperty(effectMatchName);
}
}
else{
alert("The effect name you typed in the settings does not exist. Please type another name.")
}
app.endUndoGroup();
}

Who is online

Users browsing this forum: No registered users and 1 guest