Programmatically collapse layers in table of contents

Discussion created by gismarty on Jul 17, 2012
Latest reply on Jul 30, 2012 by gismarty
Hi friends,

Does anyone have any ideas as to how I can collapse layers in my table of contents using a Python script? My current script grabs a MXD template, does a bunch of stuff, and saves a copy. Unfortunately a lot of the layers that begin minimized somehow get expanded and vice versa, and I can't figure out a way to control this. I know it's nitpicking, but it is helpful when you have a trillion things in the table contents to be able to collapse them all.

Thanks everyone!