InDesign PDF Export problem

Hello,

I am making a few applescripts for export PDF from InDesign. Because I don’t want to use prefferences I want to specify the functions in the script. Flattening etc. Everthing is working but theres only one thing I don’t get done. When you export a pdf manualy in InDesign you have the function to convert al spots to process. I’ve already found some posts in this forum how to convert to proces, but the only moment I need it is when it’s making the pdf. When the script is ready with exporting the colors in the InDesign document have to be back to spot.

Can somebody help me?

Thank you!