Automation not grabbing all elements


I’m trying to create an automation where I automatically organize a project when elements are brought in. Right now, I’m working on trying to organize any stock assets into a particular folder. Unfortunately, it only seems to be grabbing and moving the first instance of each type of stock asset I’ve identified. What am I doing wrong? Thanks!
Organize Project.json (51.1 KB)

Hi @skimber ,
Good Job with this one!

You had a mistake in the order of the functions,
you loop through all the items in the project and if an item contains a certain text you save it as a variable. but for some reason only after the loop is finished you move this item variable to the “Stock” Folder.

so in your loop went through each and every item in the project and checked if it is a stock footage but each time you just override the last variable and didn’t actually move the item to the “Stock” folder, so in this case you are left outside the loop with the last project item that the loop has identified as stock footage so you move only 1 project item of each type of stock footage.

Solution - you need to add the item to the “Stock” folder inside the loop so it will work on all the project items instead of just the last one.

  • I also removed all the different variables for each type of stock footage, if you move all the footage to the same folder you can just use the “isStock” variable to determine if you need to move a project item into this folder so all the different variables are unnecessary (but you can add them back if you need them).

Download -
Organize Project v2.json (38.9 KB)

Let me know if you have more questions.

Ah! I see! I originally made them variables because I was going to try to add them to a collection and see if I could set the collection’s parent folder, but couldn’t figure out a way to do this. I also might still need them as variables when I try to control the other assets and put them in the “Captured” folder. In other words, I plan to search for all the .jpgs, .pngs, .mov files, etc. And i want to say “if it’s not stock, put it in Captured.” Though, as I type this, I’m realizing if I have that loop run after this one, I can just say “if it’s not in the Stock folder.” LOL. Thank you for your help again!

Currently it’s hard to know of an item is inside another item when there are inner folders too, in the next update I am adding an item property called “project folder contains” so it will be easier to check if a folder contains a specific item also in inner folders.

to avoid this problem in your case I would use just 1 loop so you will move each item only once (and not have to check if it is already stock) with “items in the project” and find move each item based on some properties -
so for the case of footage, I would check if the item is a footage and if it’s name contain a stock footage name, if it is move it to the “Stock” folder, if its not (isStock = false) move it to the “captured” folder.

again I recommends you to try and use only 1 loop,

Oh, ok. That makes sense. I thought I could do it by creating an if statement like this in another loop:

Would that not work?

it will work only if the item is inside this folder but not work if it is inside a folder that is also inside this folder.

Got it. Thanks for the clarification! :slight_smile: