app.document.chooseMenuItem(); will not work in an onClick() function
This fault was reported 7 years ago but still not fixed.
https://feedback.photoshop.com/photoshop_family/topics/bridge_choosemenuitem_command_does_not_work_in_an_onclick_function
Same example...
target bridge
var w = new Window('dialog');
w.bu1 = w.add('button',undefined,'Info');
w.bu1.preferredSize=[60,30];
w.bu2 = w.add('button',undefined,'Cancel');
w.bu2.preferredSize=[60,30];
//this will work here
app.document.chooseMenuItem("mondo/command/about");
w.bu1.onClick=function(){
//Will not work here, this applies to all chooseMenuItem commands.
app.document.chooseMenuItem("mondo/command/about");
alert("Command given to show about");
}
w.show();

-
PECourtejoie commented
Please Bridge Team, listen to coders, we non-scripters rely on their ability to help us!
-
Kukurykus commented
You may use palette together with BridgeTalk as workaround:
function bS() {
win = new Window('palette');
function wa(v) {return win.add('button', [0, 0, 0, 0], v)}
for(i = 0; i < (elements = ['About', 'Cancel']).length;){
wa(elements[i++]).onClick = function() {
if (this.text == arr[1]) win.close() else
app.document.chooseMenuItem
('mondo/command/about')
}
}
win.show()
}function cnt(v) {return 'bS=' + v + ';bS()'}
(bt = new BridgeTalk()).target = 'bridge'
bt.body = cnt(bS.toSource()), bt.send(2)Also please link to this solution on PF, as I'm banned on that forum from several months :(
btw. Forum Bridge Team, please take care of opportunity to make codes indentation, THX!