My understanding is that in order to 'do stuff' with an object's attribute (a JavaScript object property, as defined in Scripting Manual), the object must be called into focus/made to be the activeItem upon which the script references for code execution.
There are many instances in which a script may call upon objects in a project, that need to be referenced through difering criteria. For example:
1. Check to see if there is an activeItem in the project panel and test to make sure that item is a CompItem (has been successfully implemented)
2. Unselect the activeItem(s) in a project so that the focus can change to a new object requiring different parameters to become the activeItem, (has been successfully implemented)
3. Make active any type of item in the project panel, that was not already selected (50% successful , 50% chair left).
- this can be accomplished by referencing the item[index]. But what if you do not know / or cant force what that index # is?
- this can presumably be accomplished referencing the app.project.item.name? It makes sense that I should be able to do this
but it almost never works. And when it does, the next project I open, it seems to stop working. Here is a snippet:
Code: Select all
var selectedComp = new Array();
for (var i = 1; i <= app.project.items.length; i++)
{
if ((app.project.items[i] instanceof CompItem)&&(app.project.items[i].name == "RENDER"))
selectedComp[selectedComp.length] = app.project.items[i];
selectedComp.selected = true;
}