ADOBE AFTER EFFECTS: Forum Expressions Tutorials Creative Cloud

Absolute File Path to Preset FFX

COW Forums : Adobe After Effects Expressions

<< PREVIOUS   •   FAQ   •   VIEW ALL   •   PRINT   •   NEXT >>
Dave Currie
Absolute File Path to Preset FFX
on Jun 9, 2018 at 9:38:03 pm

I need to get the absolute file path to an AE preset file on Windows and Mac for a script I'm working on.

This bit of code works on Mac:

var presetPath = Folder(Folder.appPackage.parent.absoluteURI + "/Presets/MyPreset.ffx");
var myPreset = File(presetPath);


However when I run the script on Windows it does not work. I also tried adding "/Support Files" at the beginning of the string but it still doesn't find the file and the rest of the script doesn't run. What am I doing wrong here?


Return to posts index

Andreas Brand
Re: Absolute File Path to Preset FFX
on Jun 11, 2018 at 2:51:25 pm

Changing the slashes to backslashes worked for me on my windows system.

var presetPath = Folder(Folder.appPackage.parent.absoluteURI + "\Presets\MyPreset.ffx");
var myPreset = File(presetPath);


Return to posts index

Dave Currie
Re: Absolute File Path to Preset FFX
on Jun 12, 2018 at 1:03:04 am

Hmm I gave that a try and it still doesn't want to work. The script creates the layers and doesn't time out or anything, but it doesn't apply the preset or any of the expressions I have set.

I looked at the JavaScript reference here:
http://estk.aenhancers.com/3%20-%20File%20System%20Access/folder-object.htm...

And tried this:
var presetPath = Folder(appPackage.parent.absoluteURI + "/Support Files/Presets/MyPreset.ffx");


I put an alert to see the actual file path that's being retrieved and everything looks correct except for maybe the beginning of the string which looks like this:
/c/Program Files/…..

And it still produces the same result :(


Return to posts index


Andreas Brand
Re: Absolute File Path to Preset FFX
on Jun 12, 2018 at 10:20:21 am

Did I understand it right? Do you want to apply a preset with the name myPreset.ffx to a layer?

I tried this on my windows-machine and with the following code it worked fine.

Hope it will work on your machine too.

With an if/else you can ask if the system is os or not.

var proj = app.project;
var comp = proj.item(1);

// Creating a textlayer with the text "Hello World"
var txtLayer = comp.layers.addText("Hello World");

//Catching the Preset with the name Schreibmschine.ffx (German wording)
var myPreset = Folder(Folder.appPackage.parent.absoluteURI + "/Support Files/Presets/Text/Animate In/Schreibmaschine.ffx");

//Apply the Preset
txtLayer.applyPreset(myPreset);


Return to posts index

Dave Currie
Re: Absolute File Path to Preset FFX
on Jun 13, 2018 at 1:36:52 am

You understood correctly, and I finally just got it to work by changing the place where the preset was applied to the layer.

Thanks for your help Andreas!


Return to posts index

<< PREVIOUS   •   VIEW ALL   •   PRINT   •   NEXT >>
© 2018 CreativeCOW.net All Rights Reserved
[TOP]