I need what I think is a very simple script. Below is what my composition looks like:

What I need is a loop which sets the work area of the composition to each layer's duration, and adds that clip to the render que. I'll be looking up how to do this myself and might be able to figure it out, but if someone could beat me to it, I have a deadline I need to meet and this would be a huge help!
Thank you very much!