changeLayerName.jsx
功能:批量更改AE图层名称中的指定字段,例如:可将名为“艾格韦尔工作室”的图层改为“猫咪韦尔工作室”。
下载链接:
百度网盘
提取码:oeub
详细代码:
function changeLayerName(){
app.beginUndoGroup('changeLayerName');
var curComp = app.project.activeItem;
if ((curComp != null) && (curComp instanceof CompItem)) {
var selLayers = curComp.selectedLayers;
var counter ;
var searchStr, replaceStr, newStr;
counter = 0;
searchStr= prompt("Enter search string" , "search text", "Find Layer Names");
replaceStr= prompt("Enter Replace string" , "replace text", "Replace Layer Names");
for (var i = 0; i < selLayers.length; i++){
var curLayer = selLayers[i];
// for (var j = 0; j < curLayer.name.length; j++){
newStr = curLayer.name.replace(searchStr, replaceStr);
if (newStr != curLayer.name) {
curLayer.name = newStr;
counter ++;
}
// }
}
alert(counter + " changes were made");
} else {
alert("Please select layers to offset");
}
app.endUndoGroup();
}
changeLayerName();
如果觉得《AE表达式与脚本——批量更改图层名称字段》对你有帮助,请点赞、收藏,并留下你的观点哦!