var numItems = app.project.numItems;
for(i = 1; i <= numItems; i++) {
if(app.project.item(i).typeName == "フッテージ") {
if( !app.project.item(i) ) continue;
var cItem = app.project.item(i).file;
if( !cItem ) continue;
var cItemPath = cItem.path;
var cItemName = cItem.name;
//拡張子
var fooPattern = /(.+)(\.[^.]+$)/;
var tExt = cItemName.match(fooPattern)[2];
var cItemExt = tExt;
//alert (cItemExt);
//alert (cItemName);
var psdExt = "psd"
var cItemFullPath = cItemPath + "/" + cItemName;
// 置換処理++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
var rFilePath = cItemPath.replace(/y/, "x");
// +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
var rFileFullPath = rFilePath + "/" + cItemName;
//alert (rFileFullPath)
var cItemMainSource = app.project.item(i).mainSource;
var cFrameRate = cItemMainSource.conformFrameRate;
var dFrameRate = cItemMainSource.displayFrameRate;
var nFrameRate = cItemMainSource.nativeFrameRate;
//alert (cFrameRate +"_"+ dFrameRate +"_"+ nFrameRate);
if( cItemMainSource.isStill == true ) {
if ( cItemExt == ".psd" ){
//alert ("psdファイルはスキップします")
}
else if ( cItemExt == ".PSD" ){
//alert ("PSDファイルはスキップします")
}
else{
var cFootageImageName = (rFileFullPath);
var cFootageImageName = decodeURI(cFootageImageName);
//alert (cFrameRate +"_"+ dFrameRate +"_"+ nFrameRate);
//alert (cFootageImageName , "イメージ")
app.project.item(i).replace(new File(cFootageImageName));
}
}
else{
if( cFrameRate == 0 ){
var cFootageMsName = (rFileFullPath);
var cFootageMsName = decodeURI(cFootageMsName);
//alert (cFrameRate +"_"+ dFrameRate +"_"+ nFrameRate);
//alert (cFootageMsName , "ムービかサウンド")
app.project.item(i).replace(new File(cFootageMsName));
}
else{
var cFootageSeqName = (rFileFullPath);
var cFootageSeqName = decodeURI(cFootageSeqName);
//alert (cFrameRate +"_"+ dFrameRate +"_"+ nFrameRate);
//alert (cFootageSeqName , "連番イメージ")
try{
app.project.item(i).replaceWithSequence(new File(cFootageSeqName),false);
} catch(err) {
var msg = cFootageSeqName + "はファイルが無いようです";
alert(msg);
}
}
}
}
}
alert ("ドライブレターの変更終了")
SyntaxHighlighter
2013年6月27日木曜日
2013年6月24日月曜日
フッテージをローカルにコピー
//今日の日時示
var now = new Date();
var year = now.getYear(); // 年
var month = now.getMonth() + 1; // 月
var day = now.getDate(); // 日
var hour = now.getHours(); // 時
var min = now.getMinutes(); // 分
var sec = now.getSeconds(); // 秒
if(year < 2000) { year += 1900; }
// 数値が1桁の場合、頭に0を付けて2桁で表示する指定
if(month < 10) { month = "0" + month; }
if(day < 10) { day = "0" + day; }
if(hour < 10) { hour = "0" + hour; }
if(min < 10) { min = "0" + min; }
if(sec < 10) { sec = "0" + sec; }
var batRcopyDir = "c:\\aeBat\\rcopy\\";
var dateDir = year +"_"+ month + "_" + day;
var curTime = hour + "_" + min;
Folder(batRcopyDir + dateDir).create();
//rcopyのオプションとbatの変数
var copyOpt = '/S /TS /TEE /ETA /R:0 /XD old tmp temp *ログ /XF log.txt Thumbs.db /XO /NP /LOG+:C:%homepath%\\roboCopyLog\\%yy%%mm%%dd%\\log"_%tt%_%ff%_%bb%".txt';
var batTitle = "@title rcopyToX"
var batPause = "@pause"
var batYyyy = "@set yyyy=%date:~0,4%"
var batYy = "@set yy=%date:~2,2%"
var batMm = "@set mm=%date:~5,2%"
var batDd = "@set dd=%date:~8,2%"
var batTt = "@set tt=%time:~0,2%"
var batFf = "@set ff=%time:~3,2%"
var batBb = "@set bb=%time:~6,2%"
var batRcopyLogDir = '@mkdir C:%homepath%\\roboCopyLog\\%yy%%mm%%dd%'
//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
var aepFullFileName = app.project.file.name;
//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
var batRcopyEnv = batTitle +" "+aepFullFileName +"_"+ "Footages" + "\n" + batPause + "\n" + batYyyy + "\n" + batYy + "\n" + batMm + "\n" + batDd + "\n" + batTt + "\n" + batFf + "\n" + batBb + "\n" + batRcopyLogDir;
alert (copyOpt);
alert (batRcopyEnv);
//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
var rcopy = "robocopy";
var randnum = Math.floor( Math.random() * 100000 );
var aepFileName = aepFullFileName.replace(aepExtension,"")
var batRcopyFile = new File( batRcopyDir + dateDir + "\\"+ "rcopy" +"_" + aepFileName +"_" + curTime +"_"+ randnum + ".bat");
batRcopyFile.open("w");
batRcopyFile.writeln(batRcopyEnv)
// 置換対象文字列
var numItems = app.project.numItems;
//myArray = new Array(numItems);
for(i = 1; i <= numItems; i++) {
if(app.project.item(i).typeName == "フッテージ") {
if( !app.project.item(i) ) continue;
var cItem = app.project.item(i).file;
if( !cItem ) continue;
//alert (cItem);
var cItemPath = cItem.path;
var cItemName = cItem.name;
var cItemStr = String (cItem);
var cItemPathStr = String (cItemPath);
var cItemNameStr = String (cItemName);
// 置換処理
var cItemPathStr = cItemPathStr.replace(/\/y\//g, "y:\\");
var cItemPathStr = cItemPathStr.replace(/\//g, "\\");
var dFilePathStr = cItemPathStr.replace(/y:\\/g, "x:\\");
//alert (cItemPathStr);
//alert (dFilePathStr);
var copyFootage = (rcopy +" "+ cItemPathStr +" "+ dFilePathStr +" "+ copyOpt)
batRcopyFile.writeln(copyFootage)
}
}
batRcopyFile.writeln(batPause)
batRcopyFile.close();
batRcopyFile.execute();
var now = new Date();
var year = now.getYear(); // 年
var month = now.getMonth() + 1; // 月
var day = now.getDate(); // 日
var hour = now.getHours(); // 時
var min = now.getMinutes(); // 分
var sec = now.getSeconds(); // 秒
if(year < 2000) { year += 1900; }
// 数値が1桁の場合、頭に0を付けて2桁で表示する指定
if(month < 10) { month = "0" + month; }
if(day < 10) { day = "0" + day; }
if(hour < 10) { hour = "0" + hour; }
if(min < 10) { min = "0" + min; }
if(sec < 10) { sec = "0" + sec; }
var batRcopyDir = "c:\\aeBat\\rcopy\\";
var dateDir = year +"_"+ month + "_" + day;
var curTime = hour + "_" + min;
Folder(batRcopyDir + dateDir).create();
//rcopyのオプションとbatの変数
var copyOpt = '/S /TS /TEE /ETA /R:0 /XD old tmp temp *ログ /XF log.txt Thumbs.db /XO /NP /LOG+:C:%homepath%\\roboCopyLog\\%yy%%mm%%dd%\\log"_%tt%_%ff%_%bb%".txt';
var batTitle = "@title rcopyToX"
var batPause = "@pause"
var batYyyy = "@set yyyy=%date:~0,4%"
var batYy = "@set yy=%date:~2,2%"
var batMm = "@set mm=%date:~5,2%"
var batDd = "@set dd=%date:~8,2%"
var batTt = "@set tt=%time:~0,2%"
var batFf = "@set ff=%time:~3,2%"
var batBb = "@set bb=%time:~6,2%"
var batRcopyLogDir = '@mkdir C:%homepath%\\roboCopyLog\\%yy%%mm%%dd%'
//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
var aepFullFileName = app.project.file.name;
//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
var batRcopyEnv = batTitle +" "+aepFullFileName +"_"+ "Footages" + "\n" + batPause + "\n" + batYyyy + "\n" + batYy + "\n" + batMm + "\n" + batDd + "\n" + batTt + "\n" + batFf + "\n" + batBb + "\n" + batRcopyLogDir;
alert (copyOpt);
alert (batRcopyEnv);
//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
var rcopy = "robocopy";
var randnum = Math.floor( Math.random() * 100000 );
var aepFileName = aepFullFileName.replace(aepExtension,"")
var batRcopyFile = new File( batRcopyDir + dateDir + "\\"+ "rcopy" +"_" + aepFileName +"_" + curTime +"_"+ randnum + ".bat");
batRcopyFile.open("w");
batRcopyFile.writeln(batRcopyEnv)
// 置換対象文字列
var numItems = app.project.numItems;
//myArray = new Array(numItems);
for(i = 1; i <= numItems; i++) {
if(app.project.item(i).typeName == "フッテージ") {
if( !app.project.item(i) ) continue;
var cItem = app.project.item(i).file;
if( !cItem ) continue;
//alert (cItem);
var cItemPath = cItem.path;
var cItemName = cItem.name;
var cItemStr = String (cItem);
var cItemPathStr = String (cItemPath);
var cItemNameStr = String (cItemName);
// 置換処理
var cItemPathStr = cItemPathStr.replace(/\/y\//g, "y:\\");
var cItemPathStr = cItemPathStr.replace(/\//g, "\\");
var dFilePathStr = cItemPathStr.replace(/y:\\/g, "x:\\");
//alert (cItemPathStr);
//alert (dFilePathStr);
var copyFootage = (rcopy +" "+ cItemPathStr +" "+ dFilePathStr +" "+ copyOpt)
batRcopyFile.writeln(copyFootage)
}
}
batRcopyFile.writeln(batPause)
batRcopyFile.close();
batRcopyFile.execute();
2013年6月14日金曜日
GUIからaerender
//今日の日時示
var now = new Date();
var year = now.getYear(); // 年
var month = now.getMonth() + 1; // 月
var day = now.getDate(); // 日
var hour = now.getHours(); // 時
var min = now.getMinutes(); // 分
var sec = now.getSeconds(); // 秒
if(year < 2000) { year += 1900; }
// 数値が1桁の場合、頭に0を付けて2桁で表示する指定
if(month < 10) { month = "0" + month; }
if(day < 10) { day = "0" + day; }
if(hour < 10) { hour = "0" + hour; }
if(min < 10) { min = "0" + min; }
if(sec < 10) { sec = "0" + sec; }
//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
var curTime = hour + "_" + min;
var batDir = "c:\\aeRenderBat\\";
var dateDir = year +"_"+ month + "_" + day;
Folder( batDir + dateDir ).create();
//var aeVersion = app.version;
//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
str = app.buildName
nStr = str.substring(0,4)
//alert (nStr)
if (nStr == 10.0) {
nStr = "CS5"
alert(nStr)
}else if (nStr == 10.5){
nStr = "CS5.5"
alert(nStr)
}else if (nStr == 11.0){
nStr = "CS6"
alert(nStr)
}else{
alert (バージョンを確認してください)
}
var randnum = Math.floor( Math.random() * 100000 );
var aeRender = '"C:\\Program Files\\Adobe\\Adobe After Effects '+ nStr +'\\Support Files\\aerender.exe"';
var projectFile = app.project.file.absoluteURI;
var aepExtension = ".aep"
var aepFullFileName = app.project.file.name;
var aepFileName = aepFullFileName.replace(aepExtension,"")
var proj = "-project";
var batFile = new File( batDir + dateDir + "\\"+ "aerender" +"_" + aepFileName +"_" + curTime +"_"+ randnum + ".bat");
//alert (aeRender+ proj + projectFile);
//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
batFile.open("w");
batFile.writeln('title' + " " + 'AfterEffects' + " " + nStr + " " + 'rendering' + " " + aepFullFileName)
batFile.writeln( aeRender + " " + '-mem_usage 10 20' + " " + proj + " " + projectFile)
batFile.close();
batFile.execute();
//
var now = new Date();
var year = now.getYear(); // 年
var month = now.getMonth() + 1; // 月
var day = now.getDate(); // 日
var hour = now.getHours(); // 時
var min = now.getMinutes(); // 分
var sec = now.getSeconds(); // 秒
if(year < 2000) { year += 1900; }
// 数値が1桁の場合、頭に0を付けて2桁で表示する指定
if(month < 10) { month = "0" + month; }
if(day < 10) { day = "0" + day; }
if(hour < 10) { hour = "0" + hour; }
if(min < 10) { min = "0" + min; }
if(sec < 10) { sec = "0" + sec; }
//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
var curTime = hour + "_" + min;
var batDir = "c:\\aeRenderBat\\";
var dateDir = year +"_"+ month + "_" + day;
Folder( batDir + dateDir ).create();
//var aeVersion = app.version;
//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
str = app.buildName
nStr = str.substring(0,4)
//alert (nStr)
if (nStr == 10.0) {
nStr = "CS5"
alert(nStr)
}else if (nStr == 10.5){
nStr = "CS5.5"
alert(nStr)
}else if (nStr == 11.0){
nStr = "CS6"
alert(nStr)
}else{
alert (バージョンを確認してください)
}
var randnum = Math.floor( Math.random() * 100000 );
var aeRender = '"C:\\Program Files\\Adobe\\Adobe After Effects '+ nStr +'\\Support Files\\aerender.exe"';
var projectFile = app.project.file.absoluteURI;
var aepExtension = ".aep"
var aepFullFileName = app.project.file.name;
var aepFileName = aepFullFileName.replace(aepExtension,"")
var proj = "-project";
var batFile = new File( batDir + dateDir + "\\"+ "aerender" +"_" + aepFileName +"_" + curTime +"_"+ randnum + ".bat");
//alert (aeRender+ proj + projectFile);
//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
batFile.open("w");
batFile.writeln('title' + " " + 'AfterEffects' + " " + nStr + " " + 'rendering' + " " + aepFullFileName)
batFile.writeln( aeRender + " " + '-mem_usage 10 20' + " " + proj + " " + projectFile)
batFile.close();
batFile.execute();
//
2013年6月13日木曜日
プロジェクトファイルからレンダリングのアウトプットを設定
var aepFullFileName = app.project.file.name;
var aepExtension = ".aep";
var aepFileName = aepFullFileName.replace(aepExtension,"");
var arrAep = aepFileName.split("_");
var arrEnd = arrAep.length -1;
var aepPath = app.project.file.path;
var vDir = arrAep[arrEnd];
var arrEnd = arrAep.length -1;
var imgDir = "images";
folderObj = new Folder(app.project.file.path +"/"+ imgDir +"/"+ vDir);
folderObj.create();
var fileNameSet = "[projectName]_[####].[fileExtension]";
alert("レンダリングのアウトプットを設定します");
var curRnedSet = app.project.renderQueue.item(1).outputModule(1);
curRnedSet.applyTemplate("hoge");
curRnedSet.file = new File(app.project.file.path +"/"+ imgDir +"/"+ vDir +"/"+ fileNameSet );
alert ("設定しました");
var aepExtension = ".aep";
var aepFileName = aepFullFileName.replace(aepExtension,"");
var arrAep = aepFileName.split("_");
var arrEnd = arrAep.length -1;
var aepPath = app.project.file.path;
var vDir = arrAep[arrEnd];
var arrEnd = arrAep.length -1;
var imgDir = "images";
folderObj = new Folder(app.project.file.path +"/"+ imgDir +"/"+ vDir);
folderObj.create();
var fileNameSet = "[projectName]_[####].[fileExtension]";
alert("レンダリングのアウトプットを設定します");
var curRnedSet = app.project.renderQueue.item(1).outputModule(1);
curRnedSet.applyTemplate("hoge");
curRnedSet.file = new File(app.project.file.path +"/"+ imgDir +"/"+ vDir +"/"+ fileNameSet );
alert ("設定しました");
登録:
投稿 (Atom)