Create number of Project folders with Automation Blocks

Contributor ,
Aug 25, 2022 Aug 25, 2022

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

TOPICS
Scripting

Views

119

Likes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Contributor ,
Sep 09, 2022 Sep 09, 2022

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.

Likes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Sep 18, 2022 Sep 18, 2022

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.

Likes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Sep 18, 2022 Sep 18, 2022

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".

 

Screenshot 2022-09-18 at 14.17.58.png

Likes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Contributor ,
Sep 20, 2022 Sep 20, 2022

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.

 

Likes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Sep 21, 2022 Sep 21, 2022

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/

 

Likes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Contributor ,
Sep 21, 2022 Sep 21, 2022

Copy link to clipboard

Copied

LATEST
quote

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.

Likes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines