Batch set FPS?

What type of scripts do you need?

Moderator: byronnash

Post Reply
Navstar
Posts: 68
Joined: February 16th, 2009, 12:41 pm

Is there a way to batch set the frame rate for a bunch of comps?
flo
Posts: 1
Joined: April 15th, 2009, 8:41 am

Code: Select all

var myItems = app.project.selection;
for (var i = 0; i < myItems.length; i++) {
	if (myItems[i] instanceof CompItem) {
		myItems[i].frameRate = 11;
		}
	}
this will set the framerate of all selected compositions to 11. if you want to change all framerates, change the first line to

Code: Select all

var myItems = app.project.items;
Jadan
Posts: 2
Joined: March 16th, 2008, 7:25 pm

flo wrote:

Code: Select all

var myItems = app.project.selection;
for (var i = 0; i < myItems.length; i++) {
	if (myItems[i] instanceof CompItem) {
		myItems[i].frameRate = 11;
		}
	}
this will set the framerate of all selected compositions to 11. if you want to change all framerates, change the first line to

Code: Select all

var myItems = app.project.items;

Hi Flo, thanks for the script! I seem to be able to get the selected comps to work, but when I run the variation of it with all items.
I get an error at the bottom of the script window from ExtendScript stating: After Effects error: Value 0 out of range 1 to 3.
The next box at the bottom says Line 3 Column 1 it is highlighting the third line, but I just copied an pasted your post and it works for Selected items...

Im a noob with scripting, so I dont understand how to change it yet. Please help!

EDIT: btw, I am using CS3 on a Mac.
"We can forgive a man for making a useful thing as long as he does not admire it. The only excuse for making a useless thing is that he admires it intensely. All art is quite useless."
-Oscar Wilde
Paul Tuersley
Posts: 704
Joined: June 5th, 2004, 7:59 am
Location: London, UK

While the first item in app.project.selection has an index of 0 (as with most arrays), the first item in app.project.items has an index of 1. So the error is saying you've asked for index 0 when the range is from 1 to 3 (the number of items in your project). Another example of this is comp.selectedLayers first index is 0, while comp.layers first index is 1 (which makes sense, as the first layer IS layer 1).

So there are a couple of other changes needed:

Code: Select all

var myItems = app.project.items;
for (var i = 1; i <= myItems.length; i++) {
	if (myItems[i] instanceof CompItem) {
		myItems[i].frameRate = 11;
	}
}
Post Reply