Skip to main content
Participant
December 13, 2021
Question

Edit Scale Composition.jsx to make scaling multiple comps at once

  • December 13, 2021
  • 1 reply
  • 559 views

Hello,

 

I'm looking for some help regarding editing a script file, specifically Scale Composition.jsx. I am often in the position where I need to scale lots of comps. Currently I go through each comp and run Scale Composition.jsx, but it is very time consuming as I'm often doing 200+ at a time. Does anyone have a method to edit Scale Composition.jsx to make it scale all of the comps I have selected in the project panel at the same time? I'm assuming I'll need to edit thisObj and activeItem to other things but I have very poor knowledge of scripting and I'm not sure what to look for exactly. Any pointers would be much appreciated. 

This topic has been closed for replies.

1 reply

Mrtn Ritter
Participating Frequently
December 13, 2021

The after effects scripting guide would come in handy here.

 

You can use:

for (i = 1; i <= app.project.numItems; i++)
{
    if (app.project.items[i] instanceof CompItem)
    {
    ...
    }
}

to apply the code to all comps in the project.

 

Or:

for (i = 0; i <= app.project.selection.length; i++)
{
    if (app.project.selection[i] instanceof CompItem)
    {
    ...
    }
}

to apply the code to the selection in the project panel. You can select everything, but the code will only applied to comps.

 

Maybe an easy hook would be wrap the selection routine around the whole existing script. So you just launch the original script through your self written one. I'm not sure, if a script can execute another one, though.

 

*Martin

Participant
December 14, 2021

Hi Martin,

Thank you very much for your reply. I can get it to go through all of the selected comps in the project window, but I still have to confirm each one. I think I'll leave it for now, as I just have to get them all done. I'll revisit it another time. Thanks again for your help.

 

Tom

Mrtn Ritter
Participating Frequently
December 14, 2021

I don't know the script well, but it should be doable to skip the confirmation. In fact, you just need to find the function which does the resizing and have a look on all the parameters, the function needs. You can hard code them, or make the input once and keep the values for the other cycles.

 

*Martin