Skip to main content
Inspiring
December 11, 2023
Answered

CompItem.exportAsMotionGraphicsTemplate() claims paths beginning with ~ (tilde) don't exist

  • December 11, 2023
  • 3 replies
  • 345 views

So this code (substituting the name of the user's home directory for [User Name] works great, the MOGRT is exported:

app.project.items[1].exportAsMotionGraphicsTemplate(true, "/Users/[User Name]/Work/test")

 

But this code throws an error saying the directory at ~/Work/test doesn't exist:

app.project.items[1].exportAsMotionGraphicsTemplate(true, "~/Work/test")

 

The ExtendScript debugger confirms the folder at ~/Work/test does in fact exist and is seen by the Folder object. This is a bug, right, and not something I'm just not getting?

This topic has been closed for replies.
Correct answer Aaron Cobb

Okay, the real solution is getting the fsName of the folder and passing THAT into exportAsMotionGraphicsTemplate(). 

3 replies

Aaron CobbAuthorCorrect answer
Inspiring
December 12, 2023

Okay, the real solution is getting the fsName of the folder and passing THAT into exportAsMotionGraphicsTemplate(). 

Inspiring
December 12, 2023

Yeah, the only way I could figure out to do it was to do a getRelativeURI("\") on the target folder and pass that string in for the path.

Adobe Employee
December 11, 2023

Well, I guess an unfortunate behavior.

 

The parameter is not a File, which then would work as you expect out of the box.

 

Instead it is just a string, and the code does not appear smart enough to resolve it before trying to see if it exists.

 

Here is what you could do:

 

Create a File object with your ~path, then pass that File object and ask for the full path into the the export call.

 

Douglas Waterfall

After Effects Engineering