I've slightly modified your code: app.bringToFront(); function main(){ var dlg= "dialog{text:'PANNEL ACTION',bounds:[100,100,510,240],"+ "panel0:Panel{bounds:[10,10,400,130] , text:'' ,properties:{borderStyle:'etched',su1PanelCoordinates:true},"+ "title:StaticText{bounds:[120,10,280,30] , text:'ACTION' ,properties:{scrolling:undefined,multiline:undefined}},"+ "ActionSet:DropDownList{bounds:[10,40,190,60]},"+ "ActionName:DropDownList{bounds:[200,40,380,60]},"+ "button0:Button{bounds:[240,80,340,105] , text:'Run' },"+ "button1:Button{bounds:[20,80,120,105] , text:'Close' }}}"; var win = new Window(dlg); if(version.substr(0,version.indexOf('.'))>9){ win.panel0.title.graphics.font = ScriptUI.newFont("Georgia","BOLDITALIC",20); g = win.graphics; var myBrush = g.newBrush(g.BrushType.SOLID_COLOR, [1.00, 1.00, 1.00, 1]); //g.backgroundColor = myBrush; //var myPen =g.newPen (g.PenType.SOLID_COLOR, [1.00, 0.00, 0.00, 1],lineWidth=1); } win.center(); var actionSets = new Array(); actionSets = getActionSets(); for (var i=0,len=actionSets.length;i<len;i++) { item = win.panel0.ActionSet.add ('item', "" + actionSets); }; win.panel0.ActionSet.selection=0; var actions = new Array(); actions = getActions(actionSets[0]); for (var i=0,len=actions.length;i<len;i++) { item = win.panel0.ActionName.add ('item', "" + actions); }; win.panel0.ActionName.selection=0; win.panel0.ActionSet.onChange = function() { win.panel0.ActionName.removeAll(); actions = getActions(actionSets[parseInt(this.selection)]); for (var i=0,len=actions.length;i<len;i++) { item = win.panel0.ActionName.add ('item', "" + actions); } win.panel0.ActionName.selection=0; }; win.panel0.button0.onClick = function() { if (valiDate()) { doAction(win.panel0.ActionName.selection.text, win.panel0.ActionSet.selection.text); } } win.panel0.button1.onClick = function() { win.close() } var x = win.show(); } main(); function valiDate(){ return true; }; function getActionSets() { cTID = function(s) { return app.charIDToTypeID(s); }; sTID = function(s) { return app.stringIDToTypeID(s); }; var i = 1; var sets = []; while (true) { var ref = new ActionReference(); ref.putIndex(cTID("ASet"), i); var desc; var lvl = $.level; $.level = 0; try { desc = executeActionGet(ref); } catch (e) { break; // all done } finally { $.level = lvl; } if (desc.hasKey(cTID("Nm "))) { var set = {}; set.index = i; set.name = desc.getString(cTID("Nm ")); set.toString = function() { return this.name; }; set.count = desc.getInteger(cTID("NmbC")); set.actions = []; for (var j = 1; j <= set.count; j++) { var ref = new ActionReference(); ref.putIndex(cTID('Actn'), j); ref.putIndex(cTID('ASet'), set.index); var adesc = executeActionGet(ref); var actName = adesc.getString(cTID('Nm ')); set.actions.push(actName); } sets.push(set); } i++; } return sets; }; function getActions(aset) { cTID = function(s) { return app.charIDToTypeID(s); }; sTID = function(s) { return app.stringIDToTypeID(s); }; var i = 1; var names = []; if (!aset) { throw "Il set azione deve essere specificato"; } while (true) { var ref = new ActionReference(); ref.putIndex(cTID("ASet"), i); var desc; try { desc = executeActionGet(ref); } catch (e) { break; // all done } if (desc.hasKey(cTID("Nm "))) { var name = desc.getString(cTID("Nm ")); if (name == aset) { var count = desc.getInteger(cTID("NmbC")); var names = []; for (var j = 1; j <= count; j++) { var ref = new ActionReference(); ref.putIndex(cTID('Actn'), j); ref.putIndex(cTID('ASet'), i); var adesc = executeActionGet(ref); var actName = adesc.getString(cTID('Nm ')); names.push(actName); } break; } } i++; } return names; }; The idea is that you create a Click event handler for the two buttons: the Run doesn't close the dialog, but runs the doAction. Let me know if I've got the valiDate function correctly. Hope this helps, Davide
... View more