Copy link to clipboard
Copied
Hi Folks,
I am trying to resize multiple Comps through script and having odd results. Hopefully someone can help clear the issue up for me.
Here is a basic example of code:
var selectedFootage = app.project.selection;
function setCompositionSize( selectedFootage )
{
for( var i=0; i<selectedFootage.length; i++ )
{
if( (selectedFootage instanceof CompItem) )
{
selectedFootage.width = sizeWidth;
selectedFootage.height = sizeHeight;
}
}
}
Note: The UI has two fields a user can enter -- Width and Height.
In the test project, I have three comps which are 1920x1080 (as set manually in the Composition Settings). The problem seems to happen when I set the size to something with a different ratio than the original (such as 648x486). The code will halt on one of these lines:
selectedFootage.width = sizeWidth;
selectedFootage.height = sizeHeight;
It will not make the change and the script will have to be force stopped. If I run the script againt, and set it to something like 1280x720, it appears to work fine.
Is there something I am missing when altering these? Any help/advice/suggestions would be greatly appreciated!
Thanks!
-Jason
Copy link to clipboard
Copied
I didn't have any problem changing a 320x200 comp to 133x50 with this:
{
var selectedFootage = app.project.selection;
function setCompositionSize( selectedFootage )
{
for( var i=0; i<selectedFootage.length; i++ )
{
if( (selectedFootage instanceof CompItem) )
{
selectedFootage.width = 133;
selectedFootage.height = 50;
}
}
}
setCompositionSize(selectedFootage);
}
Copy link to clipboard
Copied
I tried the same size Comp and changed it to the size you said worked and it did indeed work -- the first time. The second time, it didn't do anything at all.
The odd thing is that this seems to work sometimes and not others. I can't isolate the differences between the working and non-working tests.
Copy link to clipboard
Copied
I can't get it to fail--single selection, multiple selections, project bin active/inactive, etc. as long as a comp is selected.
Dan
Find more inspiration, events, and resources on the new Adobe Community
Explore Now