Expressions/Scripts/Presets

Moderator: byronnash

 
scribling
Topic Author
Posts: 143
Joined: Sun May 01, 2005 1:52 pm
Contact:

All Solos off

Mon Oct 31, 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: 318
Joined: Sat Jun 26, 2004 10:01 am
Location: Folsom, CA
Contact:

Re: All Solos off

Mon Oct 31, 2011 11:50 am

This should do it:

// 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
Topic Author
Posts: 143
Joined: Sun May 01, 2005 1:52 pm
Contact:

Re: All Solos off

Mon Oct 31, 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: 318
Joined: Sat Jun 26, 2004 10:01 am
Location: Folsom, CA
Contact:

Re: All Solos off

Mon Oct 31, 2011 1:12 pm

Ah yes, good catch. Try this version:

// 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
Topic Author
Posts: 143
Joined: Sun May 01, 2005 1:52 pm
Contact:

Re: All Solos off

Mon Oct 31, 2011 7:59 pm

Yes! That works fantastically.

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

Re: All Solos off

Mon Oct 31, 2011 8:21 pm

Like this:

// 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
Topic Author
Posts: 143
Joined: Sun May 01, 2005 1:52 pm
Contact:

Re: All Solos off

Tue Nov 01, 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: Sat Jun 05, 2004 7:59 am
Location: London, UK

Re: All Solos off

Thu Nov 03, 2011 3:47 am

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

Re: All Solos off

Fri Jan 27, 2012 10:57 am

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

I tried this:
{
  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: Sat Jun 05, 2004 7:59 am
Location: London, UK

Re: All Solos off

Fri Jan 27, 2012 11:16 am

It's .locked

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

Who is online

Users browsing this forum: No registered users and 3 guests