0
extendscript checkbox issue firing my code
Explorer
,
/t5/after-effects-discussions/extendscript-checkbox-issue-firing-my-code/td-p/13013221
Jun 17, 2022
Jun 17, 2022
Copy link to clipboard
Copied
i have issue with my checkbox code firing part of my code take a look.
if you test it by clicking button on selected solid layer it will add element effect to it.
how ever am trying to use checkbox to enable option in element 3d.
fx.property("VIDEOCOPILOT 3DArray-1202").setValue(1);//Enable Fog
if i turn it on in checkbox one after effects freezez why
var dialog = new Window("dialog");
dialog.text = "Dialog";
dialog.orientation = "column";
dialog.alignChildren = ["center","top"];
dialog.spacing = 10;
dialog.margins = 16;
var checkbox1 = dialog.add("checkbox", undefined, undefined, {name: "checkbox1"});
checkbox1.text = "Enable Fog";
var checkbox2 = dialog.add("checkbox", undefined, undefined, {name: "checkbox2"});
checkbox2.text = "Checkbox";
var checkbox3 = dialog.add("checkbox", undefined, undefined, {name: "checkbox3"});
checkbox3.text = "Checkbox";
var checkbox4 = dialog.add("checkbox", undefined, undefined, {name: "checkbox4"});
checkbox4.text = "Checkbox";
var checkbox5 = dialog.add("checkbox", undefined, undefined, {name: "checkbox5"});
checkbox5.text = "Checkbox";
var button1 = dialog.add("button", undefined, undefined, {name: "button1"});
button1.text = "Button";
button1.onClick = function () {
function setFx(lyr)
{
var eg = lyr.property("ADBE Effect Parade");
var fx = eg.addProperty("VIDEOCOPILOT 3DArray");
fx.name = "Element"
fx.enabled = true;
// Element/Scene Settings This property cannot be Scripted!
}
if (checkbox1.value == true) {
// alert ("checkbox1");
// fx.property("VIDEOCOPILOT 3DArray-1202").setValue(1);//Enable Fog
}else if (checkbox2.value == true) {
alert ("checkbox2");
}else if (checkbox3.value == true) {
alert ("checkbox3");
}else if (checkbox4.value == true) {
alert ("checkbox4");
}else if (checkbox5.value == true) {
alert ("checkbox5");
} else {
// alert ("na");
}
if ( app.project.activeItem instanceof CompItem) {
var sl = app.project.activeItem.selectedLayers;
if ( sl.length>0){
setFx(sl[0]);
}
}
}
dialog.show();
TOPICS
Expressions
,
Scripting
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting.
Learn more
Arnaldo242456048gki
AUTHOR
Explorer
,
/t5/after-effects-discussions/extendscript-checkbox-issue-firing-my-code/m-p/13013225#M203340
Jun 17, 2022
Jun 17, 2022
Copy link to clipboard
Copied
delete this post sorry fixed
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting.
Learn more
Arnaldo242456048gki
AUTHOR
Explorer
,
/t5/after-effects-discussions/extendscript-checkbox-issue-firing-my-code/m-p/13013305#M203346
Jun 17, 2022
Jun 17, 2022
Copy link to clipboard
Copied
one issue only one option works not the selected options
if (checkbox1.value == true) {
// alert ("checkbox1");
fx.property("VIDEOCOPILOT 3DArray-1202").setValue(1);//Enable Fog
}else if (checkbox2.value == true) {
// alert ("checkbox2");
fx.property("VIDEOCOPILOT 3DArray-1458").setValue(2000000);//Camera Far Plane
}else if (checkbox3.value == true) {
alert ("checkbox3");
}else if (checkbox4.value == true) {
alert ("checkbox4");
}else if (checkbox5.value == true) {
alert ("checkbox5");
} else {
// alert ("na");
}
}
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting.
Learn more
Arnaldo242456048gki
AUTHOR
Explorer
,
/t5/after-effects-discussions/extendscript-checkbox-issue-firing-my-code/m-p/13013423#M203352
Jun 17, 2022
Jun 17, 2022
Copy link to clipboard
Copied
only one value from checkbox gets added when checked why isn't others being added
if (checkbox1.value == true) {
// alert ("checkbox1");
fx.property("VIDEOCOPILOT 3DArray-1202").setValue(1);//Enable Fog
}else if (checkbox2.value == true) {
// alert ("checkbox2");
fx.property("VIDEOCOPILOT 3DArray-1458").setValue(2000000);//Camera Far Plane
}else if (checkbox3.value == true) {
alert ("checkbox3");
}else if (checkbox4.value == true) {
alert ("checkbox4");
}else if (checkbox5.value == true) {
alert ("checkbox5");
} else {
// alert ("na");
}
}
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting.
Learn more
Community Expert
,
LATEST
/t5/after-effects-discussions/extendscript-checkbox-issue-firing-my-code/m-p/13013497#M203358
Jun 17, 2022
Jun 17, 2022
Copy link to clipboard
Copied
It sounds like maybe you just need a bunch of if statements, rather than a cascading if/else, like this:
if (checkbox1.value == true) {
// checkbox 1 code
}
if (checkbox2.value == true) {
// checkbox 2 code
}
if (checkbox3.value == true) {
// checkbox 3 code
}
// etc.
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting.
Learn more

