Hi all,
I am using below script to duplicate a document. It is working fine when minVersion value is 22.0.0 in manifest.json file but when setting minVersion value to 23.0.0 or above below code does not work.
Please let me know if there is any way to resolve this issue.
I have wrapped the code as below but still the issue is same. When minVersion is 23.0.0. Below code does not work.
try {
await require('photoshop').core.executeAsModal(duplicateDocument(), {"commandName": "My Script Command"});
}
catch(e) {
if (e.number == 9) {
showAlert("executeAsModal was rejected (some other plugin is currently inside a modal scope)");
}
else {
// This case is hit if the targetFunction throws an exception
}
}
In your code now you’re passing a void/null as a first argument to executeAsModal() (simpler - a return value of duplicateDocument()), and you need to pass function itself. Try:
executeAsModal(duplicateDocument, {"commandName": "My Script Command"})
Also don’t forget to use DevTools and see what errors you get