I am quite new to the whole java script language.
But like very much all the possibilities. And so I like to improve this newly found, creative asset.
I am creating a script for an automated animation production that I am setting up.
And use an existing script that I modified. But I ran into trouble when changing some names.
I cannot see the error I made due to my lack of knowledge in this language.
Could you please help out?
Code: Select all
/* TEMPLATE test COMPOSITING MK */
// version 130117-001
var currentFootageItem;
var maDate=new Date();
var myfps=25;
var mySearch=/EP00_SC000/;
var nom=prompt("Numéros de séquence et de plan :","EP00_SC000","MK AE");
var myDuree=prompt("Durée du plan : ","480","MK AE")/25;
var z,z1=false;
var a = app.project.items;
var q = app.project.renderQueue.items
for (i=app.project.numItems; i>=1; i--){if(mySearch.test(a[i].name)){a[i].name=a[i].name.replace(mySearch,nom);a[i].duration=myDuree;z=true; if(a[i].name==(nom+"_NOMENCLATURE")){for(j=1;j<=a[i].numLayers;j++){if(mySearch.test(a[i].layer(j).name)){a[i].layer(j).sourceText.setValue(nom);a[i].layer(j).name=nom;z1=true;}}}}}
if(z&&z1){
a.addFolder("REFS_OTHER");
var b = a.addFolder(nom);
var c = a.addFolder("NOMEMCLATURE");
a.addFolder("01_ANIM").parentFolder=b;
a.addFolder("02_BG").parentFolder=b;
a.addFolder("03_FX").parentFolder=b;
c.parentFolder=b;
for (i=a.length; i>=1; i--){
if(a[i].name==nom+"_NOMENCLATURE"){a[i].parentFolder=c;}
if(a[i].name==nom+"_CONFO"){a[i].parentFolder=b;}
if(a[i].name==nom+"_720PNG"){a[i].parentFolder=b;}
if(a[i].name==nom&&!(a[i] instanceof FolderItem)){a[i].parentFolder=b;a[i].selected=true;currentFootageItem=a[i]}
a[i].selected=false
}
function aff_Date(x){if(x>9){return x;}else{return "0"+x;}}
var d=app.project.saveWithDialog();
var e=app.project.file.path;
var f=app.project.file.fsName;
var h = e.toString().split("/");
h.pop();
var g="";
for (i=0;i<h.length;i++){g=g+h[i]+"/";}
g=g+ "OUTPUT_"+nom+"/" + nom + "_720PNG_"+maDate.getFullYear().toString().substring (2,4)+aff_Date(maDate.getMonth())+aff_Date(maDate.getDay());
var curItemQ = q[1];
var curItemQOut = curItemQ.outputModule(1);
var oldLocation = curItemQOut.file;
curItemQOut.file = new File(g);
}else{
alert ("Arrêt du script : le projet AE en cours ne semble pas être une copie du template EP00_SC000.aet" , "MK AE", true)
}
here is an image of the the template file as well:

Cheers (in advanced),
Marc