Skip to main content
Known Participant
July 14, 2023
Question

Can we apply pseudo effect directly from a script

  • July 14, 2023
  • 1 reply
  • 637 views

I have a pseudo-effect XML

<Effect matchname="Pseudo/test6565" name="$$$/AE/Preset/test6565=test">
<Slider name="$$$/AE/Preset/Width2=Width" default="100" valid_min="0" valid_max="1000000" slider_min="0" slider_max="200" precision="1" DISPLAY_PERCENT="true" />
<Slider name="$$$/AE/Preset/Height2=Height" default="100" valid_min="0" valid_max="1000000" slider_min="0" slider_max="200" precision="1" DISPLAY_PERCENT="true" />
<Slider name="$$$/AE/Preset/OffsetX2=Offset X" default="0" valid_min="-1000000" valid_max="1000000" slider_min="-200" slider_max="200" precision="2" />
<Slider name="$$$/AE/Preset/OffsetY2=Offset Y" default="0" valid_min="-1000000" valid_max="1000000" slider_min="-200" slider_max="200" precision="2" />
</Effect>

Is there a way I can apply a pseudo effect using a script rather than editing the XML file

This topic has been closed for replies.

1 reply

Dan Ebberts
Community Expert
Community Expert
July 14, 2023

The way I do it is to edit the XML file, restart AE, create a comp and a layer, apply the pseudo effect by script, and then save the effect off as a preset. Now you can apply the preset with a script, without need the for the modified XML file to be present on that system.

phoenixixAuthor
Known Participant
July 15, 2023

I tried it but whenever I apply the saved preset the pseudo effect doesn't have a name in this example the effect name "test" is not shown. There's just a nameless effect applied with all the sliders working fine. This disables the expressions.

Dan Ebberts
Community Expert
Community Expert
July 15, 2023

I just tried it with the xml code from your first post. Once I added it to PresetEffects.xml and restarted AE, I used this to apply it to Layer 1 in a new comp:

var myLayer = app.project.activeItem.layer(1);
myLayer.property("Effects").addProperty("Pseudo/test6565");

Then, selecting just the effect in the timeline, I save it as a preset named "test.ffx" in the "test" folder on my C drive. Then, starting again with a new comp with a single layer, I ran this:

var myComp = app.project.activeItem;
for (var i = 1; i <= myComp.numLayer; i++){
	myComp.layer(i).selected = false;
}
var myLayer = app.project.activeItem.layer(1);
myLayer.selected = true;
var myPreset = File("c:/test/test.ffx");
myLayer.applyPreset(myPreset);

which applied your effect, named "test" to the layer. Seems to work fine.