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 amIn 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 pmIf 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 amI 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 amI 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 amThank 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….. 🙁
-
Clifford Li
March 10, 2017 at 5:22 amyes, right in C:\Program Files\Adobe\Adobe After Effects CC 2017\Support Files\Scripts
-
Dan Ebberts
March 10, 2017 at 7:11 amUnless 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
Reply to this Discussion! Login or Sign Up