I want to make a window with 2 or more checkboxes and a button. Depends what is selected when I hit the button specific function will be executed. I don't know how to change values of the checkboxes in the opened script. It always has a value of runned script. No matter I select a checkbox or not. I tried something like this:
Code: Select all
var myWin = new Window("palette", "My Window", undefined);
myWin.orientation = "row";
var groupOne = myWin.add("group", undefined, "GroupOne");
groupOne.orientation = "column";
var check1 = groupOne.add("checkbox", undefined, "CheckBox #1");
var check2 = groupOne.add("checkbox", undefined, "CheckBox #2");
var button1 = groupOne.add("button", undefined, "Button");
if (button1.value == 1){
var myFunction = function(){
alert1();
}
}else{
var myFunction = function(){
alert2();
}
}
function alert1(){
alert("ONE_ONE_ONE");
}
function alert2(){
alert("TWO_TWO_TWO");
}
button1.onClick = myFunction
myWin.center();
myWin.show();