ADOBE AFTER EFFECTS: Forum Expressions Tutorials Creative Cloud

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

COW Forums : Adobe After Effects Expressions

<< PREVIOUS   •   FAQ   •   VIEW ALL   •   PRINT   •   NEXT >>
Clifford Li
How to set a path for PC Mac and any version of AfterEffects?
on Mar 6, 2017 at 9:14:23 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?


Return to posts index

Dan Ebberts
Re: How to set a path for PC Mac and any version of AfterEffects?
on Mar 6, 2017 at 5:04:56 pm

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

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


Dan



Return to posts index

Clifford Li
Re: How to set a path for PC Mac and any version of AfterEffects?
on Mar 9, 2017 at 6:57:20 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??


Return to posts index


Dan Ebberts
Re: How to set a path for PC Mac and any version of AfterEffects?
on Mar 9, 2017 at 7:50:45 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



Return to posts index

Clifford Li
Re: How to set a path for PC Mac and any version of AfterEffects?
on Mar 9, 2017 at 8:15: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..... :(


Return to posts index

Dan Ebberts
Re: How to set a path for PC Mac and any version of AfterEffects?
on Mar 9, 2017 at 2:17:15 pm

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

Dan



Return to posts index


Clifford Li
Re: How to set a path for PC Mac and any version of AfterEffects?
on Mar 10, 2017 at 5:22:13 am

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


Return to posts index

Clifford Li
Re: How to set a path for PC Mac and any version of AfterEffects?
on Mar 10, 2017 at 5:34:08 am

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


Return to posts index

Dan Ebberts
Re: How to set a path for PC Mac and any version of AfterEffects?
on Mar 10, 2017 at 7:11:59 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



Return to posts index


Clifford Li
Re: How to set a path for PC Mac and any version of AfterEffects?
on Mar 10, 2017 at 10:03:05 am

Oh, its work!!

Thank you very much!!!


Return to posts index

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