Close/Open folders?

Find out why the . goes before the /

Moderator: Paul Tuersley

Post Reply
Simma
Posts: 98
Joined: June 8th, 2010, 2:57 pm

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.
Paul Tuersley
Posts: 704
Joined: June 5th, 2004, 7:59 am
Location: London, UK

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;
	}
}
Simma
Posts: 98
Joined: June 8th, 2010, 2:57 pm

Thanks a lot for that suggestion Paul, works perfectly!
Post Reply