confusion with photoshop’s ui boolean syntax returns an integer, not a boolean. There are several key words like Ok and Cancel that Photoshop knows and buttons with these words return hardcoded values (1 for Ok and 2 for Cancel). You can set custom returns in .onClick():

var dlg = new Window("dialog"); 

// add buttons
dlg.add ("button", undefined, "OK");
var al = dlg.add ("button", undefined, "Close with custom return value");
dlg.add ("button", undefined, "Cancel");

al.onClick = function () {

// show the dialog;;

var myReturn =;

// Ok will alert 1
// Close with custom return value will alert 10
// Cancel will alert 2

CLICK HERE to find out more related problems solutions.

Leave a Comment

Your email address will not be published.

Scroll to Top