Skip to main content
Participant
November 12, 2020
Question

[Script] Remove hidden properties ??

  • November 12, 2020
  • 1 reply
  • 164 views

So I want to write a script that removes the properties that are hidden (that have the eyeball icon disabled).

I started with this script:

var layersProperties = app.project.activeItem.selectedProperties;

for (i = 0; i < layersProperties.length; i++){
    if(layersProperties[i].enabled == false){
        layersProperties[i].remove();
    }
}

 

It works when selecting normal properties, but there's two problems:

1) The script doesn't work when selecting a PropertyGroup with another property, it deletes the first hidden PropertyGroup then gives an error message.

2) I need to manually select the properties, what can I do to make the script work by simply selecting the layers.

 

Thank you so much!

This topic has been closed for replies.

1 reply

Mylenium
Legend
November 13, 2020

Well, of course you'd have to add a sub-loop for complex property groups and check their property types. Conversely you'll have to add the pertinent code that checks the selection state of layers. AE doesn't check the contexts when launching a script. It just executes it blindly and you have to add your own safeguards.

 

Mylenium