I’m awaiting activation on a message board that’s dedicated to this stuff… in the meantime, I’ll bet somebody here can tell me what I’m doing wrong.
I’ve got a javascript that opens a dialog box in PhotoShop. So far, it should only contain two buttons, and should disappear when either of the buttons are clicked. Simple, right?
Guess not. One of the two buttons is invisible no matter what I do (although I do know it’s there); and there’s no way to close the dialog box. Gets rather vexing to have to force quit photoshop every time I try.
Code:
//create an empty dialog box
var fileDialog=new Window(‘dialog’, ‘choose a directory’, [100, 100, 480, 490]);
//add a button named submit. This works.
submit=fileDialog.add(‘button’, [35, 35, 100, 20], ‘OK’);
//add a button named cancel. cancel is not undefined, but I can never see the button.
cancel=fileDialog.add(‘button’, [35, 65, 200, 40], ‘cancel’);
//I would think this would be enough to make the file dialog disappear
//but I could be clicking on a jpg for all it's doing
submit.onClick=function() {
fileDialog.hide();
};
//this part doesn't help much because I can't see the button.
//probably also won't work, but the way this is going so far, who knows?
cancel.onClick=function() {
fileDialog.hide();
};
//show the dialog box
fileDialog.show();
Kind of cool that you can use javascript to control photoshop (wish Microsoft products allowed it), but what I’m seeing here is rather non-javascriptish.