10 Replies Latest reply on Dec 8, 2018 12:36 PM by Simon S.

    [CS3] [JS] Export PDF to the same folder as the InDesign file

    MichaelN Level 3



      I have written a JavaScript to export an InDesign file to a PDF file.


      The exporting works fine when exporting to a specific folder, but I want the script to export the PDF to the SAME folder as the InDesign file.


      For example, if the Indesign file is in a folder called "Owner's Manuals", I want the script to save the PDF into the same "Owner's Manuals" folder.


      At the moment I have:


      var myFolder = Folder.selectDialog ('Choose a Folder');


      but this dialog defaults to the Desktop every time, forcing me to click 6-7 times to locate the relevant folder where I want the PDF to be saved, which is a waste of time.


      I want the script to do something like the following:


      "Find out the location of this InDesign file, and export the PDF to the same folder"


      I have searched this forum, as well as the Scripting Reference, but without any luck.


      Any suggestions are greatly appreciated.