Skip to main content
March 27, 2012
Answered

accessing a footage item within a sub folder

  • March 27, 2012
  • 1 reply
  • 950 views

hi, in my project window i have a footage item inside a shot folder inside a episode folder.

how do i access the items within the footage folder?

app.project.folderItem.folderItem.item(1)  - obviously this is wrong, but i cant think how to do it.

can i get a helping hand please

thanks,

Sam

This topic has been closed for replies.
Correct answer Dan Ebberts

Basically like this:

var episodeFolder;

for (var i = 1; i <= app.project.numItems; i++){

    if (app.project.item(i) instanceof FolderItem && app.project.item(i).name == "Episodes"){

        episodeFolder = app.project.item(i);

        break;

    }

}

var shotFolder;

for (var i = 1; i <= episodeFolder.numItems; i++){

    if (episodeFolder.item(i) instanceof FolderItem && episodeFolder.item(i).name == "Shots"){

        shotFolder = episodeFolder.item(i);

        break;

    }

}

var myFootage;

for (var i = 1; i <= shotFolder.numItems; i++){

    if (shotFolder.item(i) instanceof FootageItem && shotFolder.item(i).name == "Footage"){

        myFootage = shotFolder.item(i);

        break;

    }

}

Dan

1 reply

Dan Ebberts
Community Expert
Community Expert
March 27, 2012

If you know the item index numbers of the episode folder within the project bin (say it's 7) and the shot folder within the episode folder (let's say 3) and the footage within the shot folder (1), you can do it like this:

var myFootage = app.project.item(7).item(3).item(1);

If you don'tnecessarily know what the item numbers are (which is usually the case), you have to find them by name, which means looping through the project bin, looking for a FolderItem whose name matches your episode folder, then looping through the items in that folder looking for a FolderItem whose name matches your shot folder, then looping through that folder looking for your footage item.

Dan

March 28, 2012

Thanks Dan. Yes that is what i want to do - but i dont know how to - first search through all the items in the panel to find a folder item. and then once that subfolder has been matched to the search name. How do i then enter that selected item ?

Sam

Dan Ebberts
Community Expert
Dan EbbertsCommunity ExpertCorrect answer
Community Expert
March 28, 2012

Basically like this:

var episodeFolder;

for (var i = 1; i <= app.project.numItems; i++){

    if (app.project.item(i) instanceof FolderItem && app.project.item(i).name == "Episodes"){

        episodeFolder = app.project.item(i);

        break;

    }

}

var shotFolder;

for (var i = 1; i <= episodeFolder.numItems; i++){

    if (episodeFolder.item(i) instanceof FolderItem && episodeFolder.item(i).name == "Shots"){

        shotFolder = episodeFolder.item(i);

        break;

    }

}

var myFootage;

for (var i = 1; i <= shotFolder.numItems; i++){

    if (shotFolder.item(i) instanceof FootageItem && shotFolder.item(i).name == "Footage"){

        myFootage = shotFolder.item(i);

        break;

    }

}

Dan