Copy link to clipboard
Copied
Hey,
I had a new idea for a simple Automations Blocks script. As I find myself sometimes in need to create a set of folders for my Compositions in the project bin I thought I might create a script to do so. However I have a couple of problems.
At the start I want the script to ask for the number of folders it will create and how to Name those(a number should also be added to the end of the naming) as well as if it should also put in a "Pre-Comps" folders(as I always find myself creating one in there as well). If I have a folder selected in the project it should paste it there otherwise I guess it would be nice to just put it in the root.
I started the script and I'm able to add one folder and the Pre-Comnps folder to the Project, however it will not take into acount the number I have added in the dialog(maybe it does but created all of the folders in top of each other as it doesn't know if it should increment the name. But I have no idea at the moment how to tackle this. I have attached my script so far.
Maybe someone can take a look and add nice features that I might not have thought of yet.
Best
Copy link to clipboard
Copied
I guess I could also just create one set of folders with a pre-comps folder in it and duplicate it a couple of times as I need it. But it would be interessting to know what I did wrong in my setup.
Copy link to clipboard
Copied
Hi Pascal,
sorry for the late reply! Essentially you need to use a count loop and then create the folder inside the loop. I will look at your code now for a more detailed answer.
Copy link to clipboard
Copied
Here is your tool 🙂
The most tricky part was picking the right parent bin. I decided to create a separate function, which checks if only exactly one project bin is currently selected. If so, it returns this bin, otherwise the root bin.
To create the numbered bin names, I just used a block which combines several strings into one (namely the string for the name that the user entered plus a space symbol plus the number. Note that you can delete the space or replace if by a "-", for example, if you want instead of "name 1" something like "name1" or "name-1".
Copy link to clipboard
Copied
Thanks again Mathias for taking the time to take a look at my script.
This is just so nice and works as I've expected it to work. I didn't even know that a helper function would be possible. Also how to setup default values in a user interface is good to know.
Copy link to clipboard
Copied
Yes, default values are very easy. Just set the variable to the values before creating the dialog. 🙂
I should probably record a tutorial about creating helper functions, since they can make bigger tools much more modular. If you click on the cog wheel icon at the top left of the helper function, you can even add function arguments.
To learn more about functions in Automation Blocks see here:
https://mamoworld.com/docs/automation-blocks/block-reference/functions/
Copy link to clipboard
Copied
I should probably record a tutorial about creating helper functions, since they can make bigger tools much more modular.
By @Mathias Moehl
That would be really cool.
Copy link to clipboard
Copied
Hey Mathias, I was wondering if you could also increment the folders by a set value(like 10) so set the first one is named 010, the second 020,... which is good for vfx work where shots are named this way
Copy link to clipboard
Copied
Hi Pascal,
the green "count with" block has a "by" parameter at the end. If you change it from 1 to 10, it will could 0,10,20,30,... instead of 0,1,2,3...
Note that the variable "number of folders" is then not really the number of folders you create, but the number of the last folder. So you count from 0 to number of last folder in intervals of 10.
Copy link to clipboard
Copied
Thanks Mathias. This seems to work fine 🙂