Suppress the dialog menu when running an ATN within a script
Is there a way to suppress the dialog menu when running an ATN file?
I have a script that I use to process a number of files within a folder.
Essentially it opens a file, selects all, copies the image. Then it opens another file and pastes the copied image into the file.
The result is a file with the proper filename and two layers (the original + the pasted image layer).
The script then runs an action file (ATN) which activates the pasted image layer and selects the color range black(creates a selection, dotted area). Then I change to the other layer and use the selection to cut the area that is all black. The problem is that occasionally there is no black in an image so the selection is empty. Which pauses the script and displays an error saying that "The command Cut is not currently available" with the options to Continue or Stop.
If I manually hit continue the script continues running, doing its job. However, it halts the progress until I hit Continue. Is there a way to suppress the dialog menu when running an ATN file?
I tried this within my script but it doesn't stop the dialog box.
app.displayDialogs = DialogModes.NO;
Here is a code snipit.
//vb_
//Metal1
//Search folder for VIEW vb_ & Metal1 png
var str1 = '*vb_**Metal1.png*' ;
var fileList = fold.getFiles(str1);
for ( var i = 0; i < fileList.length; i++ )
// Open VIEW vb_ & Metal1 png
app.open( fileList ) ;//you can enter code here to check for the file types you want or to process the images. You can get all the file here with a search mask.
//Search folder for VIEW vb_ & M2bpng
var str2 = '*vb_**M2B.png*' ;
var fileList = fold.getFiles(str2);
for ( var i = 0; i < fileList.length; i++ )
// Open VIEW vb_ & M2B png Copy Then Close and Paste In Place in original file
app.open( fileList ) ;
//prepare active document
activeFile= app.activeDocument;
//sctiveFile.resizeImage(width,height); //resize image into given size i.e 640x480
activeFile.selection.selectAll();
activeFile.selection.copy(); //copy image into clipboard
activeFile.close(SaveOptions.DONOTSAVECHANGES); //close image without saving changes
//LOAD ACTION FILE
//activate function to paste in place
pasteInPlace();
createSmartObject(app.activeDocument.activeLayer);
app.displayDialogs = DialogModes.NO;
app.doAction('BlackMetal','MyTrimMetal')
//Save Trimmed Metal1
// reference open doc
var doc = app.activeDocument;
// set save options
var opts = new ExportOptionsSaveForWeb();
opts.PNG8 = false;
opts.transparency = true;
opts.interlaced = false;
opts.quality = 100;
opts.includeProfile = false;
opts.format = SaveDocumentType.PNG; // Document Type
//Overwrite file
// save png file in same folder as open doc
activeDocument.exportDocument(doc.path, ExportType.SAVEFORWEB, opts);
activeDocument.close(SaveOptions.DONOTSAVECHANGES); //close image without saving changes
