Skip to main content
Inspiring
June 16, 2022
Question

extendscript after effects: is there a way to create a simple module to apply effects

  • June 16, 2022
  • 3 replies
  • 374 views

is there a way I can simplify my work by creating an add effect module rather than creating line-by-line code for each effect like this?

 

1: i want to create a module and call it from button click

somefunction(effect name),selected layer

somefunction(BCC Temporal Blur)selected layer

 

rather than creating big lines of codes under button click below

 

currently, i have code like this to apply or add

myComp = app.project.activeItem;
mySolid = myComp.layers.addSolid([0,.8,.4], "BG", myComp.width, myComp.height,1);
mySolid.startTime = 0

myEffect = mySolid.property("Effects").addProperty("Power Stroke");
app.endUndoGroup();

apply effect on the selected layer

var myComp = app.project.activeItem;
var preCompLayer = myComp.selectedLayers[0];
preCompLayer.property("Effects").addProperty("BCC Velocity Remap");

 

This topic has been closed for replies.

3 replies

Mathias Moehl
Community Expert
Community Expert
June 16, 2022

Not sure what exactly you want to improve here.

If you look for a very efficient and fast way to create these kinds of these "a little bit more than a basic preset in one click" tools, Automation Blocks is a great solution. Much faster than writing the code manually. See this tutorial series for an example:

Tutorial Highlight Tools

 

Automation Blocks is currently available as free, public beta until end of July.

Mathias Möhl - Developer of tools like BeatEdit and Automation Blocks for Premiere Pro and After Effects
Inspiring
June 16, 2022

thanks for the suggestion mathias but am building a script for public and my self and i just needed support buddy with the code i have.

Inspiring
June 16, 2022
function applyfxx(fxx) { 
    var myComp = app.project.activeItem;
    	  var curItem = app.project.activeItem;
	  var selectedLayers = curItem.selectedLayers;
	  var selectedProperties = app.project.activeItem.selectedProperties;
var preCompLayer = myComp.selectedLayers[0];
      if (selectedLayers == 0){
	    alert("Please Select at least one Layer");
        return;
        }

preCompLayer.property("Effects").addProperty(fxx);
}
// on selected layer

	
applyfxx("VC Orb");
Inspiring
June 16, 2022

maybe you can help fix this?

function applyfxx(fxx,selected layer) { 
var myComp = app.project.activeItem;
var preCompLayer = myComp.selectedLayers[0];
preCompLayer.property("Effects").addProperty(fxx);
}
Inspiring
June 16, 2022
function applyfxx(fxx) { 
var myComp = app.project.activeItem;
var preCompLayer = myComp.selectedLayers[0];
preCompLayer.property("Effects").addProperty(fxx);
}

applyfxx("VC Orb");

is this better can it be more better maybe call applyfxx from button click this way it shortens codes accross the project