Skip to main content
Known Participant
July 13, 2023
Answered

Can I using NEXT in Photoshop Script to bypass and action ?

  • July 13, 2023
  • 1 reply
  • 340 views

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 ?

This topic has been closed for replies.
Correct answer Stephen Marsh

@Calvin21914323wi10 

 

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:

 

https://snipit.io/public/collections/22660/22660/74742

1 reply

Stephen Marsh
Community Expert
Stephen MarshCommunity ExpertCorrect answer
Community Expert
July 13, 2023

@Calvin21914323wi10 

 

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:

 

https://snipit.io/public/collections/22660/22660/74742

Known Participant
July 13, 2023

Thank you very much, it works and much better