Page 1 of 1

Close/Open folders?

Posted: March 8th, 2012, 5:50 am
by Simma
The following code deselects all compositions in the project, but as an unwanted side effect it opens all folders. Is there a way to close the folders again?

Code: Select all

for(var i = 1; i<=app.project.numItems; i++){
    if(app.project.item(i) instanceof CompItem){
    app.project.item(i).selected = false;
    }
}
I tried with:

Code: Select all

var folder = app.project.item(1);
folder.close = true;
And it returns true, but nothing happens. Can't find any documentation on this.

Thanks for your help.

Re: Close/Open folders?

Posted: March 9th, 2012, 3:14 am
by Paul Tuersley
I don't think that's possible. But it looks like comps can only be selected if the containing folder is open, so you can prevent it from opening any folders that aren't already open with this:

Code: Select all

for(var i = 1; i<=app.project.numItems; i++){
	if(app.project.item(i) instanceof CompItem && app.project.item(i).selected){
		app.project.item(i).selected = false;
	}
}

Re: Close/Open folders?

Posted: March 9th, 2012, 6:01 am
by Simma
Thanks a lot for that suggestion Paul, works perfectly!