The project presented in this paper develops within the field of automation in the medical-surgical sector. It aims at automating the process for the realization of prosthetic devices for the skull in cranioplasty, following a craniotomy intervention for brain tumor removal. The paper puts emphasis on the possibility to create the prosthetic device in run-time during the surgery, in order to ease the work that surgeons have to do during the operation. Generally, a skull prosthesis is realized before the day of the intervention, based on the plan of the medical operation, on the results of computed tomography, and through image processing software. However, after the surgery is performed, a non-negligible geometrical uncertainty can be found between the part of the skull actually removed and the cut planned during the preliminary analysis, so that the realized prosthesis (or even the skull, at worse) may need to be retouched. This paper demonstrates the possibility to introduce a fully automated process in a hospital environment, to manufacture in runtime the prosthetic operculum, relying on the actual geometry of the incision of the skull detected during the intervention. By processing a 3D scan of the skull after the craniectomy, a digital model of the prosthesis can be created and then used as an input to generate the code to be run by a robotic system in charge of the workpiece machining. Focusing on this second step, i.e., the manufacturing process, the work describes the way the dimensions of the raw material block are automatically selected, and the way robot trajectories for milling operation are automatically generated. Experimental validation demonstrates the possibility to complete the prosthesis within the surgery time, thus increasing the accuracy of the produced prosthesis and consequently reducing the time needed to complete the operation.