Reputation: 7664
I have a script.jsx for photoshop, that exports some stuff from many PSD files. Sometimes (1 in 20 files), upon opening the psd file, the following dialog shows up:
var fileToOpen = new File(...);
open(fileToOpen);
I'm running this script on hundreds of files, and I need it to somehow ignore those dialogs. "Keep layers" would be ok, but in general, anything that will prevent the dialog will help.
I've found in a manual the option suppressWarnings, but it is only available to PdfOpenOptions
or PhotoshopSaveOptions
- there is no such thing as PsdOpenOptions
or PhotoshopLoadOptions
, neither does simple object {suppressWarnings: true}
work. I have even tried adding displayDialogs = DialogModes.NO
but that doesn't help either.
Is there a way to prevent this dialog? (ie. stop it from blocking the script's execution)
Upvotes: 3
Views: 3263
Reputation: 157
try try catch
construction. If this does not help, then set the user interaction (though this may be cumbersome):
https://forums.adobe.com/thread/289239?tstart=0
Example:
app.scriptPreferences.userInteractionLevel = UserInteractionLevels.neverInteract;
var fileToOpen = new File(...);
open(fileToOpen);
app.scriptPreferences.userInteractionLevel = UserInteractionLevels.interactWithAll;
Upvotes: 1