Smart Use of Conditional Actions in Adobe Photoshop

Smart Use of Conditional Actions in Adobe Photoshop

This tutorial is a continuation of How To Create Geometric Collages in Adobe Illustrator series of posts, it is number 5 for precision. I am using more descriptive title because we are going to automate image placement in a template created in Illustrator and imported in Photoshop. We have covered how to use action to automate task of image placement, but there is one more option which I must mention: conditional actions. Using this option introduced in Photoshop CS6 we can make our actions smarter and easier to maintain/change/adapt. The key is to understand what conditions can do and of course, to start using them.

Why to use conditional actions

So we have already recorded pretty simple action which does the job. Why to bother with conditional actions you may ask? There are a couple of reasons to use conditional actions:

  • Actions can make decisions based on condition what is a very powerful feature. For example, action with If statement can decide whether to play some other action or not.
  • More flexibility. We simply do not have the way (without conditional actions) to say: if the document has a Background layer as the bottom-most layer, then select layer above and start doing thing, otherwise start doing things from the bottom-most layer.
  • Easier to maintain, modify actions with less opportunities to make mistakes. It is easier to find error and to fix it because there are less duplicated/repetitive steps in the actions.

What is our goal

Our goal in this case is to record action(s) with maximum flexibility as possible and to use them with more then one geometric collage template. We also want to have actions which can be re-used with some other projects where we have same task: to place images above created layers to which our images will be clipped. We can automate the task in the exact same way as we did in the previous, 4th part of this series of posts. I will call action that we need: Place and clip. Here are steps:

  1. Layer Via Copy
  2. Convert to Smart Object
  3. Create Clipping Mask
  4. Select Replace Contents menu item
  5. Select Free Transform menu item
  6. Select forward layer

Where is the difficult part? We do not know in advance the number of images that we will need to place and we do not know if our document will have a Background layer or not.

I am mentioning Background layer because most of our documents have this layer plus we have available condition based on whether the layer is Background or not so we can use that condition to make our action smart and more flexible. Of course we must use the same layer as a starting point and once we make a circle through all other layers in the document we will necessarily select one more time Background layer where we can stop playing action which is doing things that we want to automate.

Simple solution

I found a solution which is, I believe, simple to understand and to apply:

  • Inform user (or remind ourselves) at the beginning of action that document must have visible Background layer.
  • Select the bottom most layer (Background because we have informed user and we expect that requirement to be met) then select above layer and start doing thing (steps listed above under Place and clip action name).
  • Separate actions and use If condition: Layer is Background > Then Play Action: None, Else Play Action: Place and clip.

Action to place images in geometric collage (or any other) template

We will work with our action recorded in the previous post. As you already know there is no point to clip something to empty layer or to the adjustment layer so that's something to keep in mind. We won't deal with that possible problem in this tutorial.

You can also record: Read Me! action to remind yourself on purpose and requirement for action that we are going to create. It is good practice when distributing actions but also and for private libraries because as your collection is growing it will be more and more difficult to keep track and immediately remind yourself about the purpose of the particular action/set.

Step 1 Duplicate steps from previous post
I will start by creating a new action in the set that I already have. That is an action set with one action only which is recorded for the previous tutorial. I will give name to the new action: Place and clip.

Steps that I am going to duplicate from the existing action are already listed above: Layer Via Copy through Select forward layer. To duplicate steps you need to select them first and then simply to drag them while holding down Alt/Opt key. While dragging, you'll see a dark gray line which indicates where will be copied dragged steps.
duplicate steps

Step 2 record action with conditional steps
The next thing that we should do is to record the action with conditional steps. In this case I found, as said earlier, that easy solution is to add reminder at the beginning of action (we will do that next) and to ensure that Background layer is present and visible.

We can start our action by selecting the bottom-most layer which is Background layer then to select layer above which is the first to use it for a clipping mask.
start of action select bottom most and forward layer

The next thing is to use conditional action from the Layers panel menu > Insert Conditional. We can use Background layer for our purpose so we need to choose: Layer Is Background from the: If Current drop-down list.
insert conditional and choose condition

There are 2 options below If Current:. The first option is: Then Play Action and here we are going to select, actually leave option: None. We want our main action with if statement to stop playing Place and Clip action when it encounters a Background layer again. This will happen when action makes entire circle, actually when it selects all layers one after another in the Layers panel. After the last or topmost layer in the Layers panel, step: Select forward layer (the last step in Place and clip action) will select Background layer. Since condition says: If Current : Layer Is Background > Then Play Action: None, we are actually done recording because that's exactly what we want: smart way to stop opening Place File dialogs, actually to stop playing Place and clip action.

From the Else Play Action: drop down, we are going to select: Place and clip action which is doing automation by helping us to place and scale placed images.
choose place and clip from else play action drop down list

The important part:
 With expanded If step you should notice that on the second line it says: Else Play Action: action "Place and clip" of set "Place images".

What is important is the name of the set in parentheses because action must be in that particular set and if you have another action set with the same name which is above the current set then you may see an error message. Step If will start looking for the set and action name from top to bottom in the Actions panel, it is not restricted to the current set in which action and If statement resides. It is a good thing for certain scenarios, otherwise just keep that information in mind.

Step 3 Duplicate If steps
The remaining part is to duplicate If steps in the Place all required images action (that's my name for the action with If condition). It is up to you how many times. You can play the same action multiple times if that's easier for you, otherwise duplicate If step "enough" times. Simplest way to duplicate step(s) is to drag them onto page icon (Create new action) at the bottom of the Actions panel.
duplicate if steps

Test action
It is a good idea to test the action while creating it. Test as often as you think it is necessary. When you gain more experience you will test less often and start using steps from any other actions which works as expected. That's one of the beauties with actions.

 Step 4 Add a reminder (Insert Stop)
 It's time to add some instructions to the user or reminder to ourselves. Use Actions panel menu > Insert Stop and type something about requirement which is in this case Background layer visible in the current document.
add reminder

Read Me! action
I have added Read Me! action with the explanation and details about the content of the action set which you can download from the link below. It is good practice to inform potential users or just to remind yourself. Who is going to remember what is about Place images (conditional) action set if this set wasn't used for a while?

Here is the link to download action set which I have recorded while writing this tutorial. I have included and PSD template with geometric collages so you can test how things work without any extra effort.

Related tutorials:

How To Create Geometric Collages in Adobe Illustrator (Part 1)
How To Create Geometric Collages in Adobe Illustrator (Part 4)

Product used in this tutorial:
Adobe Photoshop CC 2014
Adobe Illustrator CC 2014


Popular posts from this blog

How to Change Artboard Size in Adobe Photoshop

Free Puzzle Pieces Actions For Photoshop and Elements

Old Weathered Vertical Wooden Planks Free Image