This script will collapse the trees in Data Files, System Diagrams, Circuit Schematics, EM Structures, Graphs, Optimizer Goals and Yield Goals. It is useful if you want to minimize the contents of the project tab. The picture below shows before and after the script is run. The left half of the picture is before and right half is after the script is run.
If you run the script again, below is before and after the script is run.