🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: adobe.scripting.indesign
Article #390

Re: JS CS4 Print to postscript

#390
From: Kasyan_Servetsky
Date: Wed, 25 Mar 2009 15:30
37 lines
1677 bytes
Hi John,

I'm not sure if this is exactly what you want. I assume that you want to save a ps-file to 'PS_Files' folder which is one level up relative to the folder where the current InDesign's file resides. If such folder doesn't exist it will be created after confirmation.

Kasyan



var myDoc = app.activeDocument;
var myPrintPrefs = myDoc.printPreferences;

if (app.printerPresets.item("ps") == null) {
   alert("Printer preset \"ps\" is not installed.");
   exit();
}
else {
   myPrintPrefs.activePrinterPreset = app.printerPresets.item("ps");  
}

var myDocPath = myDoc.filePath;
var myFileName = myDoc.name.replace(/\.indd$/i, "") + ".ps";
var myPsFolder = new Folder(myDocPath.parent.fsName + "/PS_Files");

if (!myPsFolder.exists) {
   var myConfirm = confirm("Folder \"PS_Files\" doesn't exists. Do you wan to create it?");
   if (myConfirm) {
      myPsFolder.create();
   }
   else {
      exit();
   }
}

var myFile = new File(myPsFolder + "/" + myFileName);
myPrintPrefs.printFile = myFile;
myDoc.print(false);
alert("All done!");
Technical Details
Message-ID: <59b866b7.4@webcrossing.la2eafNXanI>
Path: arc1-ca.pugleaf.net!g2news2.google.com!news1.google.com!news.glorb.com!newshub.sdsu.edu!webcrossing
References: <59b866b7.-1@webcrossing.la2eafNXanI>

Show Full Headers
Complete Article Headers
X-Google-Thread: f939a,b0efaf9e920b645e
X-Google-Attributes: gidf939a,domainid0,public,usenet
X-Google-Language: ENGLISH,ASCII-7-bit
From: Kasyan_Servetsky@adobeforums.com
Path: arc1-ca.pugleaf.net!g2news2.google.com!news1.google.com!news.glorb.com!newshub.sdsu.edu!webcrossing
Newsgroups: adobe.scripting.indesign
Subject: Re: JS CS4 Print to postscript
Message-ID: <59b866b7.4@webcrossing.la2eafNXanI>
Date: Wed, 25 Mar 2009 08:30:30 -0700
References: <59b866b7.-1@webcrossing.la2eafNXanI>
Lines: 24
MIME-Version: 1.0
Content-Type: text/plain; charset="ISO-8859-1"
Content-Transfer-Encoding: 8bit