# Loop

loop is the most basic and important automation line type in Automation Toolkit Pro,&#x20;

when trying to automate task, you want to create a fast mechanism that can preform multiple set of actions on multiple different object.

![](https://2400490544-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MhmfherpD6FRup-Pt1p%2Fuploads%2FXyLm4isAhhA0ICX6yDOv%2Fplastic-parts-assembly-line.gif?alt=media\&token=bb1d9e6f-10b4-4c60-a12c-16f3b556d88d)

Inside Automation Toolkit Pro The loop is the main mechanism that will let you automate tasks on a number of objects, the loop type will decide what will be the set of object that the loop will go through, the default is the layers in the active composition.

the default loop will go through all layers in the active composition and run the same operations on all of them but that doesn't mean the result for every layer will be the same, with the help of other types of automation lines the loop can become smarter and differentiate layers based on their properties so it can preform differently on each layer.

### Adding Lines Inside

You can add an automation line inside the loop so as you run the automation the loop will run it’s automation lines on all available items.&#x20;



### Using the value of the loop

When adding an automation line inside the loop a new option with the name of the loop will appear on the automation line properties, this loop name will represent all of the items the loop will cycle through and show properties/actions of this specific loop type layer/project/item/property/number.

## Example -&#x20;

This basic automation use the default loop type "layer in the active composition", the generated name for this line is "loop1", "loop1" will represent each time a different layer in the composition starting with the first layer at index 1 to the last layer. then inside the "loop1" automation line using the "+" icon on this line we added an "if" line inside, this line asks a same question every time and if the answer is yes, the lines within the "if" line will be preformed too, so in this example the if line asks "is loop1 (which represents a layer) a solid?" if the answer is yes the automation continues to the "set" line that sets the "enable" property of "loop1"  to false, so if the current layer is solid, disable this layer. this if will run on all the layers and will disable all the solids.

![](https://2400490544-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MhmfherpD6FRup-Pt1p%2Fuploads%2FeWS6xa9HuZK0Aum2fm9N%2FLoop%20Example%2001.PNG?alt=media\&token=2c7a716c-89d5-4c46-b731-d5b1411071ec)

before running this automation-

<div align="left"><img src="https://2400490544-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MhmfherpD6FRup-Pt1p%2Fuploads%2FjEssUMWwJ8OySybC1V9p%2FLoop%20Example%2002.PNG?alt=media&#x26;token=ca2f1065-ea51-4b47-81a8-e3dfc063e603" alt=""></div>

after running this automation-

<div align="left"><img src="https://2400490544-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MhmfherpD6FRup-Pt1p%2Fuploads%2Ftj21U2tgNUJ9vsTSREtz%2FLoop%20Example%2003.PNG?alt=media&#x26;token=7c5487ef-25fe-4a87-98fc-6bc23cb8aba2" alt=""></div>

