I have gotten the renaming part to work using an alert but when I use replace I get a "Error Unable to execute script at line 23. After Effects error: Unable to call "item" because of parameter 1. footage.wav is not an unsigned integer.
Here is my script.
Code: Select all
{
// create an undo group
app.beginUndoGroup("ReplaceAviWithWav");
var curItem = app.project.activeItem;
var layername = curItem.name
if (curItem instanceof FootageItem)
{//check for footage items
var extPos = curItem.name.lastIndexOf(".");
//find file extension
//add suffux to comp name and remove the file extension
var curName = curItem.name.substring(0, extPos) + (".wav");
//Truncate comp name if it exceeds the 31 character limit
if (curName.length > 30){
curName = curName.slice(0,29-suffix.length) + (".wav");
}
}
var nuName = curName;
// Replaces avi with wav
//Breaks up right here.
----->var rename = app.project.item(nuName).replace(layername);
// Checks to see if data is returned
alert ("file " + layername + " is named now named " + curName );
// close the undo group
app.endUndoGroup();
}