[Lightmapping]How do you set the lightmap static flag from script?

When you select a set of meshes, is there a way in script to set the Lightmap Static flag?

I am writing an editor script that will automate our lightmapping process, so im looking for how to access gui items from within the script.

C# preferably but I can probably translate it if you know the java for it.

found it… should have looked a bit harder