Customizing a slideshow

Hi and thank you for letting me be a part of this community.
Have been lurking for the past few days and taking a look at past threads.

I’m trying to create a 100 picture slideshow where the end result would be having 100 comps in the timeline each containing their individual picture and text.
I have mapped the contents of each precomp to pull data from a spreadsheet (comment-1, comment-2 etc).

The problem is that some of the pictures are vertical and some horizontal, and I have model comps for each to use respectively. Going manually over each picture and duplicating the according model comp is time consuming however, so:

The automation I’m trying to achieve is:


If a picture is vertical ⇒ copy and use the model comp X in the timeline
If a picture is horizontal ⇒ copy and use the model comp Y in the timeline

More detailed explanation:

  1. If a picture layer in the active comp is vertical then duplicate the “Model Comp X” along with the “Model Comp X2” that is inside the “Model Comp X” containing the picture. The picture suffix is then inherited in the newly duplicated Comp name (ex. “12.jpg” ⇒ “12_Model Comp X”.

  2. The layer names in the comp are also set to inherit the picture suffix.
    For example “12.jpg” would result in “year-1” text layer name to be changed to “year-12”.

  3. If the picture is horizontal then do the same but with “Model Comp Y”.

  4. Insert the newly created Model Comp X or Y into the master comp timeline.

I tried making the automation but couldn’t figure out how to target the newly duplicated comps to put them into the timeline and replace the layer names (I have a whiff that this could be done using the index or text element function).

Please tell me if I’m overthinking this problem and there is an easier solution to it as I have been getting tunnel visioned for the past few days.

Also this automation is quite extensive so I don’t expect for a fully created code but would be happy enough to be pointed in the right direction on how to approach this issue.

Hi @kutvonen , Welcome to the forum!

I am not sure if there is a better solution for this, because I don’t know the whole process and the requirements so its hard to tell.

You can target a duplicated comp by duplicating it in a separate loop, then add another “if” line to check if the current layer property “isDuplicate” is equal to true, and if it is you can know it is the duplicated item and save it as a variable. (rememer to duplicate only 1 item per loop to make to process easier)

Check out this example -

In this example we search for an item named “Comp 1”, duplicate it, then we check again for the duplicated item, and save it as a variable and change its name to “Comp 1 Duplicate”.

Download -

Duplicate&Replace Vertical (3.8 KB)

I updated your automation from your screenshot -

I made it to partially work because I am not sure if you wanted the full automation or mainly to understand how to do it yourself.

This Automation only does the vertical model (and the vertical model img), if you understands how the vertical automation works it will be easier to add later the horizontal part, but I can help you with that too.

Currently it only duplicates both comps, modify their names with the suffix of each image, replace the model img comp within the model comp to the new duplicated one, and replace the selected image in the active comp with the duplicated vertical model.

The missing parts are -
Adding the image into the duplicated img comp or replace the current image with the new image,
and rename the layer with the suffix, also rename the text layer.

Please let me know if you have more questions.

Dude, I can’t thank you enough!
The automation you made helped me understand the process and I succeeded in changing the text layers names too.

You seriously saved me many days (probably weeks) of headache.

Here is the full automation in case anyone is interested:
Duplicate&Replace Vertical v1.json (97.2 KB)