> For the complete documentation index, see [llms.txt](https://joonaspaakko.gitbook.io/batch-mockup-smart-object-replacement-jsx-photosho/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://joonaspaakko.gitbook.io/batch-mockup-smart-object-replacement-jsx-photosho/all-options/norepeats-logic.md).

# noRepeats

If a mockup has multiple smart object targets, the script makes sure each of them uses the same amount of input files by repeating the existing input files as many times as needed to ensure all targets in a mockup have the same amount of input files. The goal with this default behavior is that every single output would contain something instead of ending up with output images where some of the smart objects are empty.

## Example

In this case **@black-mug** has 4 input files and **@white-mug** has 2 input files. The green logo is the last input file in each.

### noRepeats: false (default)

![The logos in the white mug start repeating after output image number 2.](https://1977426939-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-MhXtF7B8R3aoXvYYLDI%2F-MhYDtjo1lbTMl9HUafB%2F-MhYYcdAbJ4DdYTLwCq0%2FnoRepeats-false-uneven-inputs.jpg?alt=media\&token=dc6f896c-a671-4a03-a946-0e2843c9da33)

### noRepeats: true

![@white-mug layer is hidden after output image number 2.](https://1977426939-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-MhXtF7B8R3aoXvYYLDI%2F-MhYDtjo1lbTMl9HUafB%2F-MhYYcdCphx24IGLOKbH%2FnoRepeats-true-uneven-inputs.jpg?alt=media\&token=5fcbe637-7eef-46c5-b5de-0770d50441e3)

If you use `noRepeats: true` you either have to make sure each smart object target has the same amount of input files **or** just live with the fact that some output files will end up with objects with missing graphics.

{% hint style="info" %}
If you choose to keep the input files uneven and use `noRepeats: true`, you may need to make sure that nothing unnecessary below the target smart object becomes visible because the target layer is hidden after it runs out of images.
{% endhint %}

## Example visualization

> Just to reinforce the idea already explained above.

Columns @phone, @tablet @laptop represent a smart object target within one mockup file, and each row shows which input files end up in which output file.

### noRepeats: true

Missing input files are marked with :no\_entry\_sign:and to recap, when the script starts working on `mockup 3.jpg`, the **@tablet** smart object will be hidden because it ran out of input files and the layer will stay hidden after that. Same happens to **@laptop** smart object when it starts saving `mockup 5.jpg`.

| output (mockup.psd) | @Phone | @tablet           | @laptop           |
| :-----------------: | ------ | ----------------- | ----------------- |
|     mockup 1.jpg    | 1.jpg  | 1.jpg             | 1.jpg             |
|     mockup 2.jpg    | 2.jpg  | 2.jpg             | 2.jpg             |
|     mockup 3.jpg    | 3.jpg  | :no\_entry\_sign: | 3.jpg             |
|     mockup 4.jpg    | 4.jpg  | :no\_entry\_sign: | 4.jpg             |
|     mockup 5.jpg    | 5.jpg  | :no\_entry\_sign: | :no\_entry\_sign: |
|     mockup 6.jpg    | 6.jpg  | :no\_entry\_sign: | :no\_entry\_sign: |
|     mockup 7.jpg    | 7.jpg  | :no\_entry\_sign: | :no\_entry\_sign: |

### noRepeats: false (default)

Input files that will repeat in multiple output files files are marked with:bangbang:.

| output (mockup.psd) | @phone | @tablet              | @laptop              |
| :-----------------: | ------ | -------------------- | -------------------- |
|     mockup 1.jpg    | 1.jpg  | 1.jpg                | 1.jpg                |
|     mockup 2.jpg    | 2.jpg  | 2.jpg                | 2.jpg                |
|     mockup 3.jpg    | 3.jpg  | **1.jpg** :bangbang: | 3.jpg                |
|     mockup 4.jpg    | 4.jpg  | **2.jpg** :bangbang: | 4.jpg                |
|     mockup 5.jpg    | 5.jpg  | **1.jpg** :bangbang: | **1.jpg** :bangbang: |
|     mockup 6.jpg    | 6.jpg  | **2.jpg** :bangbang: | **2.jpg** :bangbang: |
|     mockup 7.jpg    | 7.jpg  | **1.jpg** :bangbang: | **3.jpg** :bangbang: |
