All Solos off

What type of scripts do you need?

Moderator: byronnash

Post Reply
scribling
Posts: 143
Joined: May 1st, 2005, 1:52 pm
Contact:

October 31st, 2011, 10:34 am

Is it possible to have a script that turns all solos off in all comps in a project?

This could be a nice pre-flight check before rendering as well as diagnosing problems.

Thanks.
Dan Ebberts
Posts: 319
Joined: June 26th, 2004, 10:01 am
Location: Folsom, CA
Contact:

October 31st, 2011, 11:50 am

This should do it:

Code: Select all

// turn off solo on all layers
{
  var myComp;
  for (var i = 1; i <= app.project.numItems; i++){
    if (app.project.item(i) instanceof CompItem){
      myComp = app.project.item(i);
      for (var j = 1; j <= myComp.numLayers; j++){
        myComp.layer(j).solo = false;
      }
    }
  }
}
Dan
scribling
Posts: 143
Joined: May 1st, 2005, 1:52 pm
Contact:

October 31st, 2011, 12:53 pm

Thanks for the code, but it doesn't work.

It returns "Unable to execute script at line 8. ... Solo flag can not be set on a layer if the layer is not enabled.

I was also looking for something that would run on the entire project, all comps or at least all sub comps of a selected comp.

Thanks.
Dan Ebberts
Posts: 319
Joined: June 26th, 2004, 10:01 am
Location: Folsom, CA
Contact:

October 31st, 2011, 1:12 pm

Ah yes, good catch. Try this version:

Code: Select all

// turn off solo on all layers
{
  var myComp;
  for (var i = 1; i <= app.project.numItems; i++){
    if (app.project.item(i) instanceof CompItem){
      myComp = app.project.item(i);
      for (var j = 1; j <= myComp.numLayers; j++){
        if (myComp.layer(j).solo) myComp.layer(j).solo = false;
      }
    }
  }
}

Dan
scribling
Posts: 143
Joined: May 1st, 2005, 1:52 pm
Contact:

October 31st, 2011, 7:59 pm

Yes! That works fantastically.

Is there any way to allow it to be "undo-able?"
Dan Ebberts
Posts: 319
Joined: June 26th, 2004, 10:01 am
Location: Folsom, CA
Contact:

October 31st, 2011, 8:21 pm

Like this:

Code: Select all

// turn off solo on all layers
{
  var myComp;
  app.beginUndoGroup("Turn Off All Solos");
  for (var i = 1; i <= app.project.numItems; i++){
    if (app.project.item(i) instanceof CompItem){
      myComp = app.project.item(i);
      for (var j = 1; j <= myComp.numLayers; j++){
        if (myComp.layer(j).solo) myComp.layer(j).solo = false;
      }
    }
  }
  app.endUndoGroup();
}
Dan
scribling
Posts: 143
Joined: May 1st, 2005, 1:52 pm
Contact:

November 1st, 2011, 10:16 am

Oh hell yeah! This works so good it's not even funny!

Thanks!

Say, you don't know of any way to switch the "A/V features" panel to the left or right of the "Layer Name" panel, do you?

I like to work with my A/V panel on the right of the layers (so it's there with everything else and makes sense) and several people I work with like it on the far left.
If there was a way to globally switch that it would make a lot of people happy.

Thanks again.
Paul Tuersley
Posts: 704
Joined: June 5th, 2004, 7:59 am
Location: London, UK

November 3rd, 2011, 3:47 am

Scripts don't have access to the layout of Timeline columns, so this isn't possible.
scribling
Posts: 143
Joined: May 1st, 2005, 1:52 pm
Contact:

January 27th, 2012, 10:57 am

Can I alter the "solos" script so that it locks all layers in a project?

I tried this:

Code: Select all

{
  var myComp;
  app.beginUndoGroup("Lock Everything");
  for (var i = 1; i <= app.project.numItems; i++){
    if (app.project.item(i) instanceof CompItem){
      myComp = app.project.item(i);
      for (var j = 1; j <= myComp.numLayers; j++){
        if (myComp.layer(j).lock) myComp.layer(j).lock = true;
      }
    }
  }
  app.endUndoGroup();
}
That doesn't work. I just don't know what the correct terminology is.
If anyone can alter this and get it to work, I'd appreciate it.
Paul Tuersley
Posts: 704
Joined: June 5th, 2004, 7:59 am
Location: London, UK

January 27th, 2012, 11:16 am

It's .locked

You can find it as an attribute of the Layer object in the CS3 scripting guide.
Post Reply