Automation that precompose all the layers in the composition

I’m having trouble figuring out how to create a script that grabs all the layers in a composition, creates a pre-comp and removes the assets from the original comp. If anyone can provide assistance and/or guidance on how this should be done, would be greatly appreciated.

Thank you!

Hi @rvr091, welcome to the forum!
I almost missed your post, next time please create a new topic for your question.

only precompose all the layers is quite simple (only 4 lines):

  1. create a loop with the option “layers in the active comp”.
  2. inside the loop create an item variable and set it to the loop name with the property “containing comp”, this variable will be the current composition.
  3. inside the loop set the layer “selected” property to true.
  4. outside the loop add an action line and select the variable name(the comp), select the action “precompose (move all attributes)” and type the name of the precomp. this action will precompose all the selected layers inside the composition.

the automation essentially select all the layers in the active comp and use the comp item action “precompose (move all attributes)” to precomp the layers.
download this automation -
Precompose All.json (3.8 KB)

the next part of the description of the automation is not so clear

Can you explain what should happen after precomposing all the layers, what are the assets?
(after precompose all the layers only the precomp layer left in the main comp)