Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Activity Forums Adobe After Effects Expressions Absolute File Path to Preset FFX

  • Absolute File Path to Preset FFX

    Posted by Dave Currie on June 9, 2018 at 9:38 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?

    Dave Currie replied 7 years, 11 months ago 2 Members · 4 Replies
  • 4 Replies
  • Andreas Brand

    June 11, 2018 at 2:51 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);

  • Dave Currie

    June 12, 2018 at 1:03 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:
    https://estk.aenhancers.com/3%20-%20File%20System%20Access/folder-object.html

    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 🙁

  • Andreas Brand

    June 12, 2018 at 10:20 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);

  • Dave Currie

    June 13, 2018 at 1:36 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!

We use anonymous cookies to give you the best experience we can.
Our Privacy policy | GDPR Policy