My question is two fold: Firstly, is this a bug in Photoshop? If you scale a layer and supply values of 100% like so
var srcDoc = app.activeDocument;
var numOfLayers = srcDoc.layers.length;
// main loop
for (var i = numOfLayers -1; i >= 0 ; i--)
{
var thisLayer = srcDoc.layers[i];
//select that layer as you go along
srcDoc.activeLayer = srcDoc.artLayers[i];
}
It shows the error: Error 8007: user cancelled the operation
Scale values of 100.000001, however are fine.
The second, more important part, even with displayDialogs switched off
displayDialogs = DialogModes.NO; // OFF
the user is forced to commit transform with enter or the tick button. Is there a way to suppress this?
Too much for a comment so I'll add this as an answer. User cancelled the operation
error can be helpful sometimes: for example, when you want to show UI and you don't know if user hit OK, Cancel or there was an error. And personally I think that setting a global displayDialogs
is too much in this case: if something goes wrong a user will stuck with the option you set, not the one they had. In this you can check for error number:
try
{
//some code
}
catch (e)
{
if (e.number == 8007)
{
// do something or ignore
}
else
{
// an actual error
alert(e);
}
}