UV automatic generation question

Hi…
We are still doing our exporter and we have another silly question…
We must export textures for a mesh, but UV coords are not presents.

How can we use ORCO? where we can get them… ?

or…

We found in the Editing Menu (F9), in UV Face Mode, a button that generate UV coords (UV calculation tab)… There is a way to activate
it via script ??

OK… and, just in case you know, the way coords are mapped can be Flat, Cube, Tube or Sphere… do you know how to change this via script??
Thanks…
Sebastian and Stefano