var currentDate = dateAcquisition()[0] +"_"+ dateAcquisition()[1] +"_"+ dateAcquisition()[2] ;
var currentTime = dateAcquisition()[3] +"_"+ dateAcquisition()[4];
//カレントのAepファイルのパス "-project project_path"
var aepProjectFileAbsolutePath = app.project.file.absoluteURI;
//カレントのAepファイルのバージョン
var aepFileVersion = fileNameVersionExtension(aepProjectFileAbsolutePath)[4];
//年月日取得
function dateAcquisition() {
//今日の日時示
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; }
return [ year , month , day , hour , min , sec ];
}
//ファイル名と拡張子とバージョン取得
function fileNameVersionExtension(AbsolutePath) {
//拡張子込ファイル名
var filePathAry = AbsolutePath.split("/");
var filePathAryLength = filePathAry.length -1;
var fileFullName = filePathAry[filePathAryLength];
//ファイル名とファイルタイプ(拡張子)
var fileNameAry = fileFullName.split(".");
var fileNameAryLength = fileNameAry.length -1;
var fileName = fileNameAry[0];
var fileExtension = fileNameAry[fileNameAryLength];
//ファイルネーム要素
var fileNameElement = fileName.split("_");
var fileVersionAryLength = fileNameElement.length -1;
var fileVersion = fileNameElement[fileVersionAryLength];
return [fileFullName , fileName , fileExtension , fileNameElement , fileVersion ];
}
function openDirectory() {
var aepPathObj = new Folder(app.project.file.path);
var imagesDir = app.project.file.path +"/"+ "images";
var imagesDirObj = new Folder( imagesDir );
var outputDir = app.project.file.path +"/"+ "images" +"/"+ aepFileVersion;
var outputDirObj = new Folder( outputDir );
var userTempDirObj = new Folder ( Folder.temp) ;
var aerenderDir = (userTempDirObj.toString() + "/afterEffect/aerender/");
var aerenderDirObj = new Folder( aerenderDir );
var aeBatDir = (userTempDirObj.toString() + "/afterEffect/aerender/batch/");
var aeBatchDirObj = new Folder( aeBatDir );
var aeTodayBatchDirObj = new Folder( aeBatDir + currentDate );
var aepDir = (userTempDirObj.toString() + "/afterEffect/aerender/project/");
var aepDirObj = new Folder( aepDir );
var aepTodayDirObj = new Folder( aepDir + currentDate );
return [ aepPathObj , imagesDirObj , outputDirObj , userTempDirObj , aerenderDirObj , aeBatchDirObj , aeTodayBatchDirObj , aepDirObj , aepTodayDirObj];
}
function openAepCopyDir() {
if (openDirectory()[8].exists == true) {
openDirectory()[8].execute();
}else {
if (openDirectory()[7].exists == true) {
openDirectory()[7].execute();
}else {
if (openDirectory()[4].exists == true) {
openDirectory()[4].execute();
}else {
if (openDirectory()[3].exists == true) {
openDirectory()[3].execute();
}else {
alert("ないっす!!!((((;゚Д゚))))ガクガクブルブル");
}
}
}
}
}
function openAepBatDir() {
if (openDirectory()[6].exists == true) {
openDirectory()[6].execute();
}else {
if (openDirectory()[5].exists == true) {
openDirectory()[5].execute();
}else {
if (openDirectory()[4].exists == true) {
openDirectory()[4].execute();
}else {
if (openDirectory()[3].exists == true) {
openDirectory()[3].execute();
}else {
alert("ないっす!!!((((;゚Д゚))))ガクガクブルブル");
}
}
}
}
}
function openImagesDir() {
if (openDirectory()[2].exists == true) {
openDirectory()[2].execute();
}else {
if (openDirectory()[1].exists == true) {
openDirectory()[1].execute();
}else {
if (openDirectory()[0].exists == true) {
openDirectory()[0].execute();
}else {
alert("ないっす!!!((((;゚Д゚))))ガクガクブルブル");
}
}
}
}
function openAepDir() {
if (openDirectory()[0].exists == true) {
openDirectory()[0].execute();
}else {
alert("ないっす!!!((((;゚Д゚))))ガクガクブルブル");
}
}
function inputPromptOpenDirectory() {
var selectChoice = prompt("0-2を入力してください\n"+
"0:カレントAEPファイルのフォルダを開く\n"+
"1:カレントイメージフォルダを開く\n"+
"2:バッチファイルフォルダを開く"
,"0"
,"OpenDirectory");
if (selectChoice != null) {
if (selectChoice == 0) {
openAepDir();
}else if (selectChoice == 1) {
openImagesDir();
}else if (selectChoice == 2) {
openAepBatDir();
}else if (selectChoice == 3) {
openAepCopyDir();
}else {
alert("むりっす:-p");
}
}else {
alert("キャンセルされました");
}
}
inputPromptOpenDirectory()
0 件のコメント:
コメントを投稿