Firstable, you may not need to create PS files as Indesign is able to produce PDF files natively. I was told that it was more reliable to do so using a certification profile such as PDFX.
You will find a lot of PDF export script everywhere.
However, if you want to go that way (PS to PDF). I did that once.
First you determine into distiller a hotfolder where you ps files wille be generated. Then in the hotfolder options, you precise the profile you want to use. Otherwise, distiller may be using low quality PDF as default and your PDF may not be as good as you want.
var distiller = File("c:/xxx/yyy/zzz/distiller.exe"); //the path to your distiller app.
Here you are !