Skip to main content
Participant
April 16, 2019
Question

Get full path to .ps file from dialogue app.activeDocument.pprint()

  • April 16, 2019
  • 1 reply
  • 808 views

Hello,

in my script, I print an indesign file to a ps file in the location I set in the print dialog.

#targetengine "session"

...

with(doc.printPreferences){

printer=Printer.postscriptFile;

printFile = (printPsPath + fileOnly + ".ps");

}

doc.print();

...

Is it possible to get this place back into the script? I'd like to edit this file.

Thanks in advance.

This topic has been closed for replies.

1 reply

Inspiring
April 16, 2019

Hi,

Are you wanting to edit the PostScript file or the document? After running the following  the variable doc references the InDesign document and File(printPsPath + ".ps") references the PostScript file.

var doc = app.activeDocument;

var filePath = doc.fullName;

var printPsPath = stripExt(filePath);

with (doc.printPreferences) {

    printer=1886611052;

    printFile = new File(printPsPath + ".ps");

}

doc.print(false, undefined);

function stripExt(filePath) {

    var myPath = Folder.decode(filePath);

    var extOset = myPath.indexOf(".indd");

    return myPath.substring(0, extOset);

}

Participant
April 17, 2019

Hi,

as I can see, there are some typos in my question :-(I don't know how can I this text edit )-:

I wanna know path to printed .ps file.

doc.print(); without parameters rises user dialogue, where I can change path and name of saved .ps file. I wanna to use this  data manually specified in this script.

Community Expert
April 17, 2019

You already provide that path in line 5 of your code.

Just use this with the File constructor perhaps.

var printedFile = File( printFile );

if( printedFile.exists ){ /* do something with it */ };

Regards,
Uwe