Scripting printing as postscript from InDesign

I’m having a problem scripting the GUI in InDesign. I am using InDesign CS with 10.4.8. Below is what my script looks like;

tell application “InDesign CS”
activate
set activeDoc to document 1
set n to name of activeDoc
set fileName to n & “.ps”
tell application “System Events”
tell process “InDesign CS”
keystroke “p” using command down
set frontmost to true
tell window “Print”
set properties to {enabled:true, selected:true}
–get properties of pop up button 4
–delay 2
click pop up button 3
click menu item “PDF” of menu 1 of pop up button 3
–delay 2
click button “Printer…”
delay 2
set properties to {enabled:true, selected:true}
click button “Done”
–keystroke return
end tell
get properties of window “Print”
(keystroke “p” using command down
delay 2
keystroke return
get properties of text field 1 of front window --“Print to File”
set value of text field 1 of front window to fileName
keystroke return
)
end tell
end tell
end tell

I found this script inside these forums this morning and it seems to work great except for one thing. When the script gets to the "click button “Printer…”, the script actually clicks the “Printer…” button however nothing happens. The new “Print” dialog box doesn’t open as it should. Is there something I’m missing with this script? I appreciate anyone’s help with this. Thank you in advance!!

Why doing this in GUI?

I’m using the GUI approach because I’m not sure how to write a script through the app. Do you know of a way?

just use:

print page without print dialog