Copy link to clipboard
Copied
The code as following, but photoshop keep raide error on NEXT
if (theW-targetW >10||theH-targetH>10){
alert(theW-targetW,theH-targetH);
NEXT
};
var bounds = [0,0,targetW, targetH]
app.activeDocument.crop(bounds);
How should I bypass the corp action if meet the criteria ?
No, not Next. You need to use the following if/else/else if – there are many code examples in the forum if you search.
https://www.w3schools.com/js/js_if_else.asp
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/if...else
Here is a Photoshop example of a simple conditional:
Copy link to clipboard
Copied
No, not Next. You need to use the following if/else/else if – there are many code examples in the forum if you search.
https://www.w3schools.com/js/js_if_else.asp
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/if...else
Here is a Photoshop example of a simple conditional:
Copy link to clipboard
Copied
Thank you very much, it works and much better