// DialogSimpleButton.jsx
// http://forums.adobe.com/thread/1327372?tstart=0
// how to add buttons in script, which on click run different codes?
// regards pixxxelschubser
function SimpleDialog() {
var w = new Window('dialog', '');
this.windowRef = w;
w.orientation = "column";
btn1 = w.add('button',undefined,'Button 1');
btn2 = w.add('button',undefined,'Button 2');
btn3 = w.add('button',undefined,'Button 3');
btn4 = w.add('button',undefined,'Button 4');
btnOK = w.add('button',undefined,'OK');
btnCancel = w.add('button',undefined,'Cancel');
btn1.onClick = function() {alert("Button 1");};
btn2.onClick = function() {alert("Button 2");};
btn3.onClick = function() {alert("Button 3");};
btn4.onClick = function() {alert("Button 4");};
defaultElement = btnOK;
cancelElement = btnCancel;
btnOK.active = true;
btnOK.onClick = function() {
stuff = "your stuff";
w.close();
}
w.show();
}
var stuff = null;
SimpleDialog ();
if (stuff) alert(stuff);