Hi everyone,
I've only just begun scripting for AE (currently using 6.5 till our upgrades turn up). I have a scripting background in other apps but I'm struggling with some of the basics here.
I'm trying to write a script to replace a bunch of selected sequences and their proxies. Each piece of footage should share a common folder up to a point but may be nested in sub folders. The proxies will just be pointing to a global folder.
I'm actually struggling at the point of retrieving the path of a piece of footage. I can get the piece of footage but if i use the following
var myItemCollection = app.project.item(1);
clearOutput();
writeLn (myItemCollection.file);
all it returns is "File"
I dont quite understand how to get the string that contains the whole path rather than it returning the object "file" And I cant find any other functions in the help to actually return the path of footage only for the project itself.
I think I'm doing some fundamental things wrong here and need a push in the right direction. Any help appreciated
DaveMcD
Footage replace, beginners trouble
Moderator: Paul Tuersley
- lloydalvarez
- Enhancement master
- Posts: 460
- Joined: June 17th, 2004, 9:27 am
- Location: New York City, NY
- Contact:
Hey Dave,
Not sure why writeLn returns "File" but if you switch it to an alert you get the full path you are looking for
-Lloyd
Not sure why writeLn returns "File" but if you switch it to an alert you get the full path you are looking for
-Lloyd
Code: Select all
var myItemCollection = app.project.item(1);
clearOutput();
alert (myItemCollection.file);
- redefinery
- Posts: 112
- Joined: April 1st, 2005, 8:16 pm
- Location: CA
- Contact:
hi DaveMcD,DaveMcD wrote: var myItemCollection = app.project.item(1);
clearOutput();
writeLn (myItemCollection.file);
app.project.item(1) returns an Item object (AVItem and FootageItem for footage), and referencing .file returns a File object, so when you writeLn() that object, it displays the name of the object (i.e., File).
i don't have 6.5 in front of me, but you should be able to get the full path by using .fsName or .fullName, as in:
Code: Select all
writeLn (myItemCollection.file.fsName);
also, a small distinction about your myItemCollection variable name... app.project.items returns an ItemCollection object, but app.project.item(n) returns a specific Item object within the ItemCollection.
hope this helps.
:jeff
Cheers guys
Thanks for the points in the right direction. I was just struggling with trying to find out the properties for each part of the object. I've done lots of maxscript and some actionscript but not a lot of javascript.
In maxscript you can usually query the properties available for an object be typing 'show'. So if i had an object called myitem i could type 'show myitem' and it would return the first tier of properties for that object such as
.name
.size
.file
so you can trace the settings of an object by then going 'show myitem.file' which would return
.pathname etc
Is there an equivalent in javascript / after effects.
Cheers
DaveMcD
Thanks for the points in the right direction. I was just struggling with trying to find out the properties for each part of the object. I've done lots of maxscript and some actionscript but not a lot of javascript.
In maxscript you can usually query the properties available for an object be typing 'show'. So if i had an object called myitem i could type 'show myitem' and it would return the first tier of properties for that object such as
.name
.size
.file
so you can trace the settings of an object by then going 'show myitem.file' which would return
.pathname etc
Is there an equivalent in javascript / after effects.
Cheers
DaveMcD
- redefinery
- Posts: 112
- Joined: April 1st, 2005, 8:16 pm
- Location: CA
- Contact:
i can't confirm right now if it's in 6.5, but in 7.0 and CS3 you can use the reflection interface to do something like:DaveMcD wrote:so you can trace the settings of an object by then going 'show myitem.file' which would return
.pathname etc
Is there an equivalent in javascript / after effects.
myitem.reflect.properties
myitem.reflect.methods
of course, if you're using 7.0 or CS3, you can use the bundled ExtendScript Toolkit (v1.2 in 7.0, v2.0 in CS3) and its Data Browser to view this info. it also has a JavaScript Console for typing in the above, instead of creating a script to do so.
hope this helps.
:jeff
hmmm very interesting.
Well we've ordered CS3 the other day. I think I might install the 30 day trial version and just start working in that.
Thanks for your help.
DaveMcD
Well we've ordered CS3 the other day. I think I might install the 30 day trial version and just start working in that.
Thanks for your help.
DaveMcD