Photoshop: How do I create a conditional if/else action?

  • 1
  • Question
  • Updated 3 years ago
  • Answered
  • (Edited)
hi, i have to process thousands of pictures every day and i created already actions for them, but i'd like to have an option if the picture is vertical apply action number 1 otherwise apply action number 2, do u have any ideas how to do it?
so i found one script maybe helps but i don't know how to use it
Photo of sergio mohor

sergio mohor

  • 2 Posts
  • 0 Reply Likes

Posted 7 years ago

  • 1
Photo of Jeffrey Tranberry

Jeffrey Tranberry, Sr. Product Manager, Digital Imaging

  • 14190 Posts
  • 1787 Reply Likes
Official Response
I have a bunch of materials on my personal website on scripting Photoshop:

http://tranberry.com/photoshop/photos...

The script you want specifically is (right-click and save to your computer):

http://tranberry.com/photoshop/photos...

Create and save your two actions you want to run. Open the "imageAspectConditional.jsx" in a text editor (TextEdit or ExtendScript Tool Kit) and replace the name of the action and action set in the doAction functions:

if (app.activeDocument.height > app.activeDocument.width)

{
// Run this action if the IF statement is true.
doAction("My Great Action","Default Actions");
}
else
{
// Run this action if the IF statement is false
doAction("My Great Action2","Default Actions");
}


Save the changes to the "imageAspectConditional.jsx" file and place it in the Presets>Scripts folder in the Photoshop application folder and restart Photoshop.

Create a new action and select the script from the File>Scripts> menu.