Page 1 of 1

Javascript equivalent to 'Reveal layer source in project'

Posted: August 12th, 2011, 2:04 pm
by i4n
Hello All,

Does anyone know the javascript equivalent to 'Reveal layer source in project and be willing to share'?
I've been digging through the normal reading channels and either It's staring me in the face and I'm not seeing it, or I'm just not good enough at this yet...

What I'm trying to do:
Be able to select an AV Layer in the timeline and with one script have it show me the footage's location in Finder

How far I've gotten:
//var getIt = app.project.activeItem.file;
//alert(getIt)
I'm able to get a return of the path of the object by selecting a layer in the Project panel. I know I'm not very close but at this point I'm going in circles. Even a pointer in the right direction would be greatly appreciated.

Thanks

Re: Javascript equivalent to 'Reveal layer source in project

Posted: August 29th, 2011, 2:59 pm
by lloydalvarez
What's not working with what you have? Are you asking about file sequences?

Re: Javascript equivalent to 'Reveal layer source in project

Posted: August 30th, 2011, 1:27 am
by Paul Tuersley
You can find a selected comp layer's filename/path with something like this:

Code: Select all

var theLayer = app.project.activeItem.selectedLayers[0];
alert(theLayer.source.file.fsName);
It sounds like you want to use the "Reveal in Finder" option. There are no exact equivalents to either that or "Reveal Layer Source in Project" in scripting.

If the project window is selected, you can use this undocumented method to do the "Reveal in Finder" bit:

Code: Select all

app.project.item(2).selected = true; // select second item in project
app.executeCommand(app.findMenuCommandId("Reveal in Finder"));
Unfortunately the same thing doesn't work for "Reveal Layer Source in Project", and there isn't a way to make the project window active either.

Re: Javascript equivalent to 'Reveal layer source in project

Posted: September 21st, 2011, 4:39 pm
by i4n
Thanks for the replies. Since there is no way to make the project panel active, is there a way to pass a command outward to the terminal? With the name of the directory I could perform a simple "open "<path>"" command in the mac terminal and get what I want - a new finder window at the directory containing my footage.

Re: Javascript equivalent to 'Reveal layer source in project

Posted: September 29th, 2011, 6:10 am
by lloydalvarez
Yes, you can execute commands in the terminal by using system.callSystem(). You will need to make sure the "Allow scripts to access network" is checked in AE before you use that command or you will get an error.