Migrating my own scripts from cs6 to cc does not work.....

Find out why the . goes before the /

Moderator: Paul Tuersley

Post Reply
bkan
Posts: 51
Joined: November 6th, 2013, 8:33 am

July 4th, 2014, 2:53 am

Hello,
I made many scripts for my own work, which was working when I used CS.
Now I'm on CC, certains scripts don't work. When I clic on it, nothing happens, even the JSdebugger does not load....

For example, this script, which add a wiggle parameter, does not work anymore :

function wiggleController_fonction(){
// Vérifions si il n'y a qu'un calque sélectionné
if (app.project.activeItem.selectedLayers.length == 1){

var calque = app.project.activeItem.selectedLayers[0];

if (calque.selectedProperties.length != 0){

//Prendre l'effet
var effet = app.project.activeItem.selectedLayers[0].selectedProperties.pop();

//Vérifier si le calque est en 3D ou pas
var isTroisD;
if(app.project.activeItem.selectedLayers[0].threeDLayer){
isTroisD="true";
}
else{
isTroisD="false";
}

//Vérifier quelle propriété est sélectionnée
var maPropriete = app.project.activeItem.selectedLayers[0].selectedProperties[0].name;
var proprieteMultiple;
if(maPropriete=="Position"||maPropriete=="Echelle"||maPropriete=="Point d'ancrage"||maPropriete=="Orientation"){
proprieteMultiple="true";
}
else{
proprieteMultiple="false";
}
//on vérifie sin on peut mettre une expression, sinon inutile de continuer
if(effet.canSetExpression) {

// début de groupe d'annulation
app.beginUndoGroup(traduction(["Spring","Rebond","Spring"]));

//Vérifier s'il existe déjà un controlleur
var curComp = app.project.activeItem
var nbControlleur = 1;
var reg_exp = /Controlleur_wiggle/;
for (var i = 1; i <= curComp.numLayers; i++) {
if(curComp.layers.name.match(reg_exp)){
nbControlleur=nbControlleur+1;
}
}

var monControleur = app.project.activeItem.layers.addNull();
monControleur.name = "Controlleur_wiggle"+nbControlleur;

if (effet.parentProperty.isEffect){
var effetIndex = effet.propertyIndex;
var effetProfondeur = effet.propertyDepth;
var effetParentName = effet.parentProperty.name;
var frequence = monControleur.Effects.addProperty("ADBE Slider Control");
frequence.name = traduction(["Frequency","Fréquence","Frequency"]);
frequence(1).setValue(0.5);
var amplitude = monControleur.Effects.addProperty("ADBE Slider Control");
amplitude.name = traduction(["Amplitude","Amplitude","Amplitude"]);
amplitude(1).setValue(50);
var wiggleX = monControleur.Effects.addProperty("ADBE Checkbox Control");
wiggleX(1).setValue(1);
wiggleX.name = traduction(["wiggleX","wiggleX","wiggleX"]);
var wiggleY = monControleur.Effects.addProperty("ADBE Checkbox Control");
wiggleY(1).setValue(1);
wiggleY.name = traduction(["wiggleY","wiggleY","wiggleY"]);
//effet = app.project.activeItem.selectedLayers[0].effect(effetParentName)(effetIndex);
//=============================================
//expression a insérer
var expressionspring;
if(proprieteMultiple=="true"){
if(isTroisD=="true"){
var wiggleZ = monControleur.Effects.addProperty("ADBE Checkbox Control");
wiggleZ(1).setValue(1);
wiggleZ.name = traduction(["wiggleZ","wiggleZ","wiggleZ"]);
var expressionspring = "frequence = thisComp.layer(\"" +monControleur.name+ "\").effect(\"" + traduction(["Frequency","Fréquence","Frequency"]) + "\")(1);amplitude = thisComp.layer(\"" +monControleur.name+ "\").effect(\"" + traduction(["Amplitude","Amplitude","Amplitude"]) + "\")(1);w=wiggle(frequence,amplitude);var valX;var valY;var valZ;\n" +
"if(thisComp.layer(\"" +monControleur.name+ "\").effect(\"" + traduction(["wiggleX","wiggleX","wiggleX"]) + "\")(1)==1){valX=w[0];}else{valX=value[0];}\n"+
"if(thisComp.layer(\"" +monControleur.name+ "\").effect(\"" + traduction(["wiggleY","wiggleY","wiggleY"]) + "\")(1)==1){valY=w[1];}else{valY=value[1];}\n"+
"if(thisComp.layer(\"" +monControleur.name+ "\").effect(\"" + traduction(["wiggleZ","wiggleZ","wiggleZ"]) + "\")(1)==1){valZ=w[2];}else{valZ=value[2];}\n"+
"[valX,valY,valZ];"
}
else{
expressionspring = "frequence = thisComp.layer(\"" +monControleur.name+ "\").effect(\"" + traduction(["Frequency","Fréquence","Frequency"]) + "\")(1);amplitude = thisComp.layer(\"" +monControleur.name+ "\").effect(\"" + traduction(["Amplitude","Amplitude","Amplitude"]) + "\")(1);w=wiggle(frequence,amplitude);var valX;var valY;var valZ;\n" +
"if(thisComp.layer(\"" +monControleur.name+ "\").effect(\"" + traduction(["wiggleX","wiggleX","wiggleX"]) + "\")(1)==1){valX=w[0];}else{valX=value[0];}\n"+
"if(thisComp.layer(\"" +monControleur.name+ "\").effect(\"" + traduction(["wiggleY","wiggleY","wiggleY"]) + "\")(1)==1){valY=w[1];}else{valY=value[1];}\n"+
"[valX,valY];"
}
}
else{
expressionspring = "frequence = thisComp.layer(\"" +monControleur.name+ "\").effect(\"" + traduction(["Frequency","Fréquence","Frequency"]) + "\")(1);amplitude = thisComp.layer(\"" +monControleur.name+ "\").effect(\"" + traduction(["Amplitude","Amplitude","Amplitude"])+ "\")(1) ;\n"+
"wiggle(frequence,amplitude)";
}
//=============================================

effet.expression = expressionspring;

} else {
var effetIndex = effet.propertyIndex;
var effetProfondeur = effet.propertyDepth;
var effetParentName = effet.parentProperty.name;
var frequence = monControleur.Effects.addProperty("ADBE Slider Control");
frequence.name = traduction(["Frequency","Fréquence","Frequency"]);
frequence(1).setValue(0.5);
var amplitude = monControleur.Effects.addProperty("ADBE Slider Control");
amplitude.name = traduction(["Amplitude","Amplitude","Amplitude"]);
amplitude(1).setValue(50);
var wiggleX = monControleur.Effects.addProperty("ADBE Checkbox Control");
wiggleX(1).setValue(1);
wiggleX.name = traduction(["wiggleX","wiggleX","wiggleX"]);
var wiggleY = monControleur.Effects.addProperty("ADBE Checkbox Control");
wiggleY(1).setValue(1);
wiggleY.name = traduction(["wiggleY","wiggleY","wiggleY"]);
//effet = app.project.activeItem.selectedLayers[0].effect(effetParentName)(effetIndex);
//=============================================
//expression a insérer
var expressionspring;
if(proprieteMultiple=="true"){
if(isTroisD=="true"){
var wiggleZ = monControleur.Effects.addProperty("ADBE Checkbox Control");
wiggleZ(1).setValue(1);
wiggleZ.name = traduction(["wiggleZ","wiggleZ","wiggleZ"]);
var expressionspring = "frequence = thisComp.layer(\"" +monControleur.name+ "\").effect(\"" + traduction(["Frequency","Fréquence","Frequency"]) + "\")(1);amplitude = thisComp.layer(\"" +monControleur.name+ "\").effect(\"" + traduction(["Amplitude","Amplitude","Amplitude"]) + "\")(1);w=wiggle(frequence,amplitude);var valX;var valY;var valZ;\n" +
"if(thisComp.layer(\"" +monControleur.name+ "\").effect(\"" + traduction(["wiggleX","wiggleX","wiggleX"]) + "\")(1)==1){valX=w[0];}else{valX=value[0];}\n"+
"if(thisComp.layer(\"" +monControleur.name+ "\").effect(\"" + traduction(["wiggleY","wiggleY","wiggleY"]) + "\")(1)==1){valY=w[1];}else{valY=value[1];}\n"+
"if(thisComp.layer(\"" +monControleur.name+ "\").effect(\"" + traduction(["wiggleZ","wiggleZ","wiggleZ"]) + "\")(1)==1){valZ=w[2];}else{valZ=value[2];}\n"+
"[valX,valY,valZ];"
}
else{
expressionspring = "frequence = thisComp.layer(\"" +monControleur.name+ "\").effect(\"" + traduction(["Frequency","Fréquence","Frequency"]) + "\")(1);amplitude = thisComp.layer(\"" +monControleur.name+ "\").effect(\"" + traduction(["Amplitude","Amplitude","Amplitude"]) + "\")(1);w=wiggle(frequence,amplitude);var valX;var valY;var valZ;\n" +
"if(thisComp.layer(\"" +monControleur.name+ "\").effect(\"" + traduction(["wiggleX","wiggleX","wiggleX"]) + "\")(1)==1){valX=w[0];}else{valX=value[0];}\n"+
"if(thisComp.layer(\"" +monControleur.name+ "\").effect(\"" + traduction(["wiggleY","wiggleY","wiggleY"]) + "\")(1)==1){valY=w[1];}else{valY=value[1];}\n"+
"[valX,valY];"
}
}
else{
expressionspring = "frequence = thisComp.layer(\"" +monControleur.name+ "\").effect(\"" + traduction(["Frequency","Fréquence","Frequency"]) + "\")(1);amplitude = thisComp.layer(\"" +monControleur.name+ "\").effect(\"" + traduction(["Amplitude","Amplitude","Amplitude"])+ "\")(1) ;\n"+
"wiggle(frequence,amplitude)";
}
//=============================================

effet.expression = expressionspring;

}

//fin du groupe d'annulation
app.endUndoGroup();

}else{alert(traduction(["Cannot create expressions on this effect","On ne peut pas créer d'expression sur cet effet","Cannot create expressions on this effect"]),traduction(["Impossible wiggle","wiggle impossible","Impossible wiggle"]));}
}else{alert(traduction(["Select the effect where you want to create the wiggle","Veuillez sélectionner un effet où appliquer le wiggle","Select the effect where you want to create the wiggle"]),traduction(["No effect selected","Pas d'effet sélectionné","No effect selected"]));}
}else{alert(traduction(["Select the effect where you want to create the wiggle","Veuillez sélectionner un effet où appliquer le wiggle","Select the effect where you want to create the wiggle"]),traduction(["No layer selected","Pas de calque sélectionné","No effect selected"]));}

}


Have any idea??

Thanks in advance, and sorry for my bad english (i'm a fucking frenchy!)
beginUndoGroup
Posts: 81
Joined: November 27th, 2012, 6:41 am

July 4th, 2014, 7:33 am

//Vérifier si le calque est en 3D ou pas
var isTroisD;
if(app.project.activeItem.selectedLayers[0].threeDLayer){
isTroisD="true";
}
else{
isTroisD="false";
}

if (isTroisD == "true"){}
Is that french style ?
bkan
Posts: 51
Joined: November 6th, 2013, 8:33 am

July 5th, 2014, 7:11 am

OK, but it worked on CS6!
beginUndoGroup
Posts: 81
Joined: November 27th, 2012, 6:41 am

July 7th, 2014, 5:33 am

The above bit of code is surely not the reason why your script doesnt work, it's just strange (but cute!).

The thing is that your code is hard to read overall and it is consequently hard to help.

What is not working ? Do you have errors or nothing happens ?
Try to put some breakpoints (or alerts) along the script and try to follow the execution step by step.

Xavier.
Post Reply