-
AE Script “Else” isn’t working
I’m trying to create a script that will run different functions based on input (yes/no) from the user. I can get either set of functions to work, but I can’t get them both to work based on the user’s input. If true (third line), the script will run the functions of child and proximity. If I set it to false, it will run the function custom. For some reason, yes or no is running the same set of functions. Here’s the code:
app.beginUndoGroup("Proximity");
if (confirm("Standard transform properties?"));
if (true){
function child(){
var myComp = app.project.activeItem;
var scriptFolderPath = File($.fileName).path;
var colorFolderPath = scriptFolderPath + encodeURI("/preset");
var ffxFile = new File(colorFolderPath + encodeURI("/Proximity Child.ffx"));
myComp.applyPreset(ffxFile);
}
child()
function proximity(){
var controller = app.project.activeItem.layers.addNull();
controller.name = "proximity";
controller.enabled = true;
var scriptFolderPath = File($.fileName).path;
var colorFolderPath = scriptFolderPath + encodeURI("/preset");
var ffxFile = new File(colorFolderPath + encodeURI("/Proximity Master.ffx"));
controller.applyPreset(ffxFile);
}
proximity()
}
else
{
function custom(){
var myComp = app.project.activeItem;
var scriptFolderPath = File($.fileName).path;
var colorFolderPath = scriptFolderPath + encodeURI("/preset");
var ffxFile = new File(colorFolderPath + encodeURI("/Proximity Custom.ffx"));
myComp.applyPreset(ffxFile);
}
custom()
}
app.endUndoGroup();