Script UI Event Listener - ff6347/extendscript GitHub Wiki
##Event Listener on click actions Have a look at jongwares JavaScript Reference Guide here --> written for this stackoverflow
var win = new Window ('dialog'); // Build a dialog
/**
* First argument: the UI resource
* Second: the size. If it is undefined it will be calculated
* by the size of the text
* Third: the text that appears on the button
*/
win.button = win.add ('button', undefined, "Button");
/**
* now add the event listener to the action 'click' and pass 'k'
* as the pressed keys
*/
win.button.addEventListener ('click', function (k) {
if (k.shiftKey) {
alert("foo"); // shift is clicked
}else{
alert("bah"); // now its not
}
});
win.show (); // show the dialog