Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Activity Forums Adobe After Effects Expressions How to set a path for PC Mac and any version of AfterEffects?

  • How to set a path for PC Mac and any version of AfterEffects?

    Posted by Clifford Li on March 6, 2017 at 9:14 am

    In aftereffect script, I set a path to apply preset to a solid like this:

    var myFx = File(“C:/Program Files/Adobe/Adobe After Effects CC 2017/Support Files/Scripts/myPresets/FXs/StrokeAMain.ffx”);

    But how can I write a path work in both of pc and mac? and also any version of after effects?

    Clifford Li replied 9 years, 2 months ago 2 Members · 9 Replies
  • 9 Replies
  • Dan Ebberts

    March 6, 2017 at 5:04 pm

    If your script is in the Scripts folder, it would be like this:

    File($.fileName).path + “/” + “myPresets/FXs/StrokeAMain.ffx”

    Dan

  • Clifford Li

    March 9, 2017 at 6:57 am

    I moved the .ffx inside script folder
    And put File($.fileName).path into my script like this.

    var theComp = app.project.activeItem;
    var StrokeASolid = theComp.layers.addSolid([0, 0, 0], “StrokeA Main”,1920, 1080, 1.0, 20);
    var StrokeAFx = File($.fileName).path + “/” + “StrokeAMain.ffx”
    StrokeASolid.applyPreset(StrokeAFx);

    But not working, anything I missed or did wrong??

  • Dan Ebberts

    March 9, 2017 at 7:50 am

    I think applyPreset() needs a file object, not a path, so it would be like this:

    StrokeASolid.applyPreset(File(StrokeAFx));

    You also may need to make sure your layer is selected.

    Dan

  • Clifford Li

    March 9, 2017 at 8:15 am

    Thank you for your reply.
    But I just tried, not working as well.
    And I tried the old way like this, and it worked.

    button.onClick = function(){

    var theComp = app.project.activeItem;
    var StrokeASolid = theComp.layers.addSolid([0, 0, 0], “StrokeA Main”,1920, 1080, 1.0, 20);
    StrokeASolid.blendingMode = BlendingMode.ADD;
    var StrokeAFx = File(“C:/Program Files/Adobe/Adobe After Effects CC 2017/Support Files/Scripts/StrokeAMain.ffx”);
    StrokeASolid.applyPreset(StrokeAFx);

    }

    Thats why I am wondering….. 🙁

  • Dan Ebberts

    March 9, 2017 at 2:17 pm

    Are the script and the .ffx in the same folder?

    Dan

  • Clifford Li

    March 10, 2017 at 5:22 am

    yes, right in C:\Program Files\Adobe\Adobe After Effects CC 2017\Support Files\Scripts

  • Clifford Li

    March 10, 2017 at 5:34 am

    And I’am working on PC window 10, After Effects cc2017.

  • Dan Ebberts

    March 10, 2017 at 7:11 am

    Unless I’m making a silly mistake, this should work:

    var StrokeAFx = File(File($.fileName).path + “/” + “StrokeAMain.ffx”);
    StrokeASolid.applyPreset(StrokeAFx);

    What happens when you try it?

    Dan

  • Clifford Li

    March 10, 2017 at 10:03 am

    Oh, its work!!

    Thank you very much!!!

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