Page 1 of 1

Get the full path filename of a layer?

Posted: February 17th, 2009, 6:09 am
by Atomic
Does anyone have any code that will fetch the full path filename of a layer?

I can't seem to find any way. I'm on CS3.

Re: Get the filename of a layer?

Posted: February 17th, 2009, 7:09 am
by Paul Tuersley
theLayer.source.name

Re: Get the filename of a layer?

Posted: February 17th, 2009, 12:19 pm
by lloydalvarez
on the subject.. anyone know how to get the full OS name of a sequence? ie if I import a sequence:

fileA_001.png
fileA_002.png
fileA_003.png

In AE I get:

fileA_[001-003].png

but sometimes if the file name is too long to fit i will get this:

fileA_[].png


Is there a way to get scripting to get me this:

fileA_001.png

Re: Get the filename of a layer?

Posted: February 17th, 2009, 12:54 pm
by Paul Tuersley
theItem.file.name

Re: Get the filename of a layer?

Posted: February 17th, 2009, 1:22 pm
by lloydalvarez
Merci. :mrgreen:

Re: Get the filename of a layer?

Posted: February 17th, 2009, 1:48 pm
by Atomic
Thats just the name of the layer, I need the fullpath file name to the footage of the layer.

Re: Get the full path filename of a layer?

Posted: February 17th, 2009, 2:07 pm
by Paul Tuersley
theLayer.source.file
theLayer.source.file.path
theLayer.source.file.absoluteURI

All the file related stuff is in the JavaScript Tools Guide
http://www.adobe.com/devnet/scripting/

Re: Get the full path filename of a layer?

Posted: February 18th, 2009, 6:48 am
by Atomic
Thanks Paul,

I could not find that info in the CS3 PDF Scripting Guide I was working from.

Re: Get the full path filename of a layer?

Posted: February 25th, 2009, 8:43 am
by Atomic
Is there any way to repair the URI information returned to make a working path?

I get a value like this:
/e/My%20Documents/Maps/Animated/Cloud%20Tours/CF106.mov
This does not work on Windows. Is there a convert URI to working path function?

REVISION:
I did manage to get a working conversion from URI to Windows DOS path, but I doubt if this will work for OSX.
// Convert to Windows style file pathing.
G.LAYER_FILENAME = G.LAYER_FILENAME.replace(/%20/g," ");
G.LAYER_FILENAME = G.LAYER_FILENAME.replace(/\//,"");
G.LAYER_FILENAME = G.LAYER_FILENAME.replace(/\//,":\\");
G.LAYER_FILENAME = G.LAYER_FILENAME.replace(/\//g,"\\");