Mmmm.... not really. I`d like to keep nested comps inside main comp, and match start and end of these comps to start end of main. And also don`t know the exact length of main comp (or rather comps) to set it manually.
In case of using the script you offer I have to keep in mind the length of main comp, then pick the right nested comps from different folders of project to set it for each of them, which is not very convincing. And as far as I understand the length of nested comps will be set from the start, while I need to keep time period currently visible in the main comp.
Anyway thanks for trying to help :)