1 Reply Latest reply on Aug 1, 2013 9:31 AM by DaveSofTypefi

    Help using tagged text in document in exported filename

    erblo007 Level 1

      Hello, I am using the following script to export my Indesign documents as single page PDFs, and naming in a specific way:

       

      var pdfPreset = "<PDF_preset>";

      var exportPath = "<filepath>";

      var jobNumber = "XXXXXX_"

      for (aPage=0; aPage < app.activeDocument.pages.length; aPage++)

      {

      app.pdfExportPreferences.pageRange = app.activeDocument.pages[aPage].name;

      app.activeDocument.exportFile (ExportFormat.PDF_TYPE, File(exportPath+"/"+jobNumber+pad(app.activeDocument.pages[aPage].name)+".pdf"), false, pdfPreset);

       

      function pad (n) {

          return ("00000"+n).slice(-3);

      }

      }

       

       

      This will output the filenames as XXXXXX_002-003, etc, where XXXXXX is the customers ID number.

       

      Instead of typing in each customers ID number in the script, I want to tag a text box within the document that contains only the customer's job number, then use the contents of that text box as the jobNumber variable.

       

      How can I do that?