I have a fully working action which includes a script call. The script includes an executeAction with suppressed dialogs (DialogModes.NO).
Everything works flawlessly when run in photoshop and also when using Automate->Batch... in Photoshop.
However, when I select the images in Bridge and then invoke the action via Tools-Photoshop->Batch, The dialog keeps appearing abd interrupts the action. DialogModes.NO seems to be ignored when running it this way.
Thankful for any insight into this.
/Johan
Script:
main();
function main(){
if(!documents.length) return;
makeLayerActiveByName("Layer 0");
var fileName = decodeURI(activeDocument.name);
var fileName = fileName.substring(0,fileName.length - 4)
activeDocument.activeLayer.name= decodeURI(fileName);
}
function makeLayerActiveByName(nm) {
function cTID(s) { return app.charIDToTypeID(s); };
try {
var desc5 = new ActionDescriptor();
var ref4 = new ActionReference();
ref4.putName( cTID('Lyr '), nm);
desc5.putReference( cTID('null'), ref4 );
desc5.putBoolean( cTID('MkVs'), false );
executeAction( cTID('slct'), desc5, DialogModes.NO );
return true;
} catch (e) {
return false;
}
};