Hello,
I try to apply preset on text layers selected, but it doesn't work. I can't understand why :
var presetPath = ("C:\Program Files\Adobe\Adobe After Effects CS6\Support Files\Presets\PRESETS PERSOS\NEW MATRUNKS\animTexte3D.ffx");
var myPreset = File(presetPath);
for (var i=0;i<app.project.activeItem.selectedLayers.length;i++){
var calque = app.project.activeItem.selectedLayers;
calque.applyPreset(myPreset);
}
Any idea?
launch a preset bug
Moderator: Paul Tuersley
-
- Posts: 704
- Joined: June 5th, 2004, 7:59 am
- Location: London, UK
It worked ok for me. Are you getting any errors? Is the debugger enabled in the prefs?
Maybe the file path is incorrect?
Here's some code you can try:
Use this to help confirm you've got the file path right. It will also tell you if the file exists. Note that I've removed the for loop. Although you need to specify a layer to apply the preset to, it will apply it to all selected layers, exactly the same behaviour as if you did it manually.
Paul
Maybe the file path is incorrect?
Here's some code you can try:
Code: Select all
var thePreset = File.openDialog("Locate the preset");
$.writeln(thePreset.fsName);
var presetPath = ("C:\Program Files\Adobe\Adobe After Effects CS6\Support Files\Presets\PRESETS PERSOS\NEW MATRUNKS\animTexte3D.ffx");
var myPreset = File(presetPath);
$.writeln(myPreset.exists);
var calque = app.project.activeItem.selectedLayers[0];
calque.applyPreset(myPreset);
Paul
Thank you again, Paul!
But it's really strange, because on my computer, I locate the prest and clic OK, but then after effects tell me "Line 7 Execution halted" (for the line "calque.applyPreset(myPreset);"). I had the same error in my previous code ; strange, isn't it?
But it's really strange, because on my computer, I locate the prest and clic OK, but then after effects tell me "Line 7 Execution halted" (for the line "calque.applyPreset(myPreset);"). I had the same error in my previous code ; strange, isn't it?
-
- Posts: 704
- Joined: June 5th, 2004, 7:59 am
- Location: London, UK
That code doesn't hook up what you select in the dialog to what you apply as the preset. Does it write true or false into your ESTK console? This will tell you if your path in the code is pointing to a correct file. If not, swap it with the path that gets written to the console after the File.open dialog.
Or to hook it up to the file chosen in the dialog change:
calque.applyPreset(myPreset);
to
calque.applyPreset(thePreset);
Paul
Or to hook it up to the file chosen in the dialog change:
calque.applyPreset(myPreset);
to
calque.applyPreset(thePreset);
Paul
The ESTK console wrote "false".....Paul Tuersley wrote:That code doesn't hook up what you select in the dialog to what you apply as the preset. Does it write true or false into your ESTK console? This will tell you if your path in the code is pointing to a correct file. If not, swap it with the path that gets written to the console after the File.open dialog.
Or to hook it up to the file chosen in the dialog change:
calque.applyPreset(myPreset);
to
calque.applyPreset(thePreset);
Paul
But even when I changed calque.applyPreset(myPreset); to calque.applyPreset(thePreset);,
the same error appears : "line 7 execution halted"
-
- Posts: 704
- Joined: June 5th, 2004, 7:59 am
- Location: London, UK
Have you tried applying the preset manually to check it works ok?
Paul
Paul
-
- Posts: 704
- Joined: June 5th, 2004, 7:59 am
- Location: London, UK
Yes it works fine for me. Of course I can't recreate exactly what you're doing. I'm using one of the included Adobe presets to test it. I created a comp with two solids, selected them both then ran the script. I did it both with a modified presetPath and by changing the last line to use the myPreset variable used in the File.openDialog method.
I don't recognise the "line 7 execution halted" error. Is that exactly what it says? Where does it say it? In an error dialog that comes up in AE? What version of AE are you running?
Paul
I don't recognise the "line 7 execution halted" error. Is that exactly what it says? Where does it say it? In an error dialog that comes up in AE? What version of AE are you running?
Paul
-
- Posts: 704
- Joined: June 5th, 2004, 7:59 am
- Location: London, UK
Hmm. I've been testing this in AE CC but just tried CS6 (all on Mac) and it worked. I realise you're on Windows though.
Have you tried it with other presets, such as the built-in Adobe ones? The only thing I can think of is that it's something about the preset. It uses some effect that isn't installed in CS6 or something. Obviously if you've tried it with other presets and it still isn't working in CS6 then it isn't that.
Paul
Have you tried it with other presets, such as the built-in Adobe ones? The only thing I can think of is that it's something about the preset. It uses some effect that isn't installed in CS6 or something. Obviously if you've tried it with other presets and it still isn't working in CS6 then it isn't that.
Paul