Hi,
Does anyone have a script example using FootageItem replace() method to replace a footage file with another file? As a newbie scripter, I have tried many approaches and keep getting "app.project.item() is undefined" in line 6 when calling the method. The item index is valid and correct
The extendkit javascript console shows the variables project and filepath correctly, however app.project.item(70) shows Result: [object CompItem] ... I expected a footage item, or a file object ?!?
The method shown in the JavaScript reference shows: app.project.item(index).replace(f i l e )

Hi Dan,
Thanks for the tip... I redid the short script as follows, but I still get the orange bar in line 9 with the same error message...
app.project.item().replace is undefined ?!?
I'm sure I'm missing something simple, but I can't seem to get this to work.
I've added a screen capture of the extendscript view showing all the variables reporting correctly in the Javascript console, but the script won't work.

Thanks Dan... the only answer must be that the index is wrong (it shows as a Comp item, not a footage item in the javascript console....
app.project.item(70)
Result: [object CompItem]
Do you have an easy way to get the index for footage items in the project panel?

I know you worked with Jeff on his "rd_GimmePropPath()" script... can it be modified to give the index for footage items? That would be a great functional improvement for the script.

Unless you have a really good reason for referencing it by number, I wouldn't do it that way. If you can look it up by name, that seems like it would less subject to getting messed up if you add anything to the project. Just go through the project bin looking for a FootageItem with the correct name. Or do you not know the name?

Hey Dan....
I wrote a small script to iterate through the app.project.item collection checking for the app.project.item.name I was looking for... got the correct index number... changed the index in the script, and viola !

Now I have to write a data entry inquiry for the name of a footage item, and using a variable run the script to find any footage item's index... shouldn't take me more than a month Just kidding.

Thanks again for the help.. if you come up with a way to redo the gimme proper path script so it can give the index of a selected footage item, let me know. It would take me too long to figure out the script and what to change (it might be a good learning experience though, so maybe when I have more time)... for you it's probably too easy

Maybe a dumb question, but my Javascript Console does not print out all variable results as it shows in your screenshot. It only prints "Result: undefined" after every script I run. It only prints something else when I explicitly use "$.writeln". Am I missing something? (I'm on a Mac.)

Hi Dan...
OK... I wrote a script to loop through app.project.numItems and check if the item was selected.
If true, give me the index of the item.
So... easy enough... select a footage item, run script, and get the correct index number, then make the replacement.

Once again... many thanks. Without knowing it worked for you, I would not have known it had to be the index value which was causing the problem (maybe I'd figure it out in a year or so, but my walls can't take the strain