Page 1 of 1

Apply animation preset

Posted: November 7th, 2008, 4:19 am
by spewperb
Hi everyone,

Im trying to apply a custom animation preset to a layer but I keep getting a

"Unable to call "applyPreset" because of parameter 1 - /Applications/Adobe After Effects CS3/Presets/Custom Preset.ffx is not a File or Folder Object"

My code looks like:

Code: Select all

function projectItem(name)
{
	var items = app.project.items;
	j = 1;
	
	while (j <= items.length) {
		if (items[j].name == name)
		{
			return app.project.item(j);
			break;
		}
		j++;
	}
}

projectItem("test").layer(1).applyPreset("/Applications/Adobe After Effects CS3/Presets/Custom Preset.ffx");
Please help!

Re: Apply animation preset

Posted: November 10th, 2008, 12:35 pm
by Mylenium
You may need to escape the path delimiters and convert the spaces.

Mylenium

Re: Apply animation preset

Posted: November 11th, 2008, 3:25 am
by Paul Tuersley
This should work:

Code: Select all

var thePreset = new File("/Applications/Adobe After Effects CS3/Presets/Custom Preset.ffx");

if (thePreset.exists == true) {
	theLayer.applyPreset(thePreset);
} else {
	alert("no preset found at specified path");
}

Re: Apply animation preset

Posted: November 13th, 2008, 10:10 am
by spewperb
Cheers Paul, worked like a treat!