Apply animation preset

What type of scripts do you need?

Moderator: byronnash

Post Reply
spewperb
Posts: 4
Joined: November 7th, 2008, 2:18 am

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!
Mylenium
Posts: 139
Joined: July 20th, 2005, 12:07 am

You may need to escape the path delimiters and convert the spaces.

Mylenium
[Pour Mylène, ange sur terre]
Paul Tuersley
Posts: 704
Joined: June 5th, 2004, 7:59 am
Location: London, UK

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");
}
spewperb
Posts: 4
Joined: November 7th, 2008, 2:18 am

Cheers Paul, worked like a treat!
Post Reply