My plugin that used to work just fine started giving me a random error when calling batchPlay():
“The command failed because Photoshop is in a modal state”.
I haven’t used the plugin in the last few months, so am not sure if Photoshop update broke something or if it’s a race condition that revealed a preexisting defect.
My plugin does two basic things, each of which has its own button and underlying JS function:
AddBorder to all open images.
Save all open images.
Both features work conceptually the same way:
Iterate through app.documents and set app.activeDocument = app.documents[i];
Get values from app.activeDocument
Set and Get UI element values using document.getElementById();
Perform some calculations
Execute various batchPlay commands.
The error occurs in both functions upon calling a batchPlay. It happens randomly. E.g. I may have 10 images opened and sometimes processing of all images succeeds, sometimes it breaks on a random image.
I’m still debugging through it, but I wonder if I’m violating some key concepts that would cause the stated error message.
I’m not ready to post any code here just yet as I would have to simplify it quit a bit to make it useful.
Thank you.