In addition to Your question:
it would be very useful to change the Ref Des in dependence of the Cells.
Font, width and hight.
In better times, I had a Program that did it in ASCII.
Here is an easy start. It was just kind of hard to find. Documentation of the automatoin layer is as good as it is, can be difficult to navigate.
For Each fabtext In pcbDoc.fabricationlayertexts
If fabtext.type=epcbFabAssembly Then