0 Replies Latest reply on Aug 1, 2017 2:41 PM by mikeb41294032

    Error trying to open pdfs exported by script on a network file server

    mikeb41294032 Level 1

      Hello Forum!

       

      I am getting the below Error message when trying to open pdfs output to specific folders within a project on a network file server created by two specific scripts.

      I can use other scripts like the page Exporter Utility or a direct export out of InDesign on the same server/project folder structure without any issue.

      Could there possibly be something with the scripts causing this?

       

      Thanks in advance for any help!

       

       

       

      Screen Shot 2017-08-01 at 3.00.29 PM.png

       

       

       

      The two scripts that are giving me the issue;

       

       

       

        var doc = app.activeDocument;

        

         for(var p = 0; p < app.documents[0].pages.length; p=p+2) {

           var frames = app.documents[0].pages[p].textFrames;

           var pdf_name = null;

       

           for(var i = 0; i < frames.length; i++) {

                if(frames[i].paragraphs[0].appliedParagraphStyle.name == 'UAVC-IHD') {

                     pdf_name = frames[i].paragraphs[0].contents;

                     break;

                }

           }

       

           if(pdf_name != null) {

      app.pdfExportPreferences.pageRange =

      "+"+( doc.pages[p].documentOffset+1 ) + "," +

      "+"+( doc.pages[p+1].documentOffset+1 );

       

       

                var export_preset1 = app.pdfExportPresets.item("[High Quality Print]");

                var export_preset2 = app.pdfExportPresets.item("[Smallest File Size]");

       

       

      var myFolder = app.activeDocument.filePath.parent;

      var myDoc = app.activeDocument;

       

      }  

       

       

      myDoc.exportFile(ExportFormat.PDF_TYPE, File(myFolder+'/Final_Deliverables/Publish/' + pdf_name + "HR.pdf"), false, export_preset1);

      myDoc.exportFile(ExportFormat.PDF_TYPE, File(myFolder+'/Final_Deliverables/Proofs/'  + pdf_name + "-00.pdf"), false, export_preset2);

           }

       

       

      alert("Done Exporting Pdf's!");

       

       

       

      And..............

       

       

       

      var myDoc = app.activeDocument,

          p, i, frames, pdf_name,

        

        

          myFolder = myDoc.filePath.parent;

      for(p = 1; p < myDoc.pages.length; p=p+2) {

          frames = myDoc.pages[p].textFrames;

        

        

          pdf_name = null;

          for(i = 0; i < frames.length; i++) {

              if(frames[i].paragraphs[0].appliedParagraphStyle.name == 'UAVC-IHD') {

                 pdf_name = frames[i].paragraphs[0].contents;

                 break;

                 }

              }

        

          if(!pdf_name) continue;

          app.pdfExportPreferences.pageRange = myDoc.pages[p-1].name + "-" + myDoc.pages[p].name;

        

          

                var export_preset1 = app.pdfExportPresets.item("[High Quality Print]");

                var export_preset2 = app.pdfExportPresets.item("[Smallest File Size]");

        

        

          myDoc.exportFile(ExportFormat.PDF_TYPE, File(myFolder+'/Final_Deliverables/Publish/' + pdf_name + "HR.pdf"), false, export_preset1);

          myDoc.exportFile(ExportFormat.PDF_TYPE, File(myFolder+'/Final_Deliverables/Proofs/'  + pdf_name + "-00.pdf"), false, export_preset2);

          }

       

      alert("Done Exporting Pdf's!");

       

       

       

       

       

      Here's a script that is used without issue.

       

       

       

      d = app.activeDocument;

       

      preset1 = app.pdfExportPresets.itemByName("[High Quality Print]");

      preset2 = app.pdfExportPresets.itemByName("[Smallest File Size]");

      if (!(preset1.isValid && preset2.isValid)){

      alert("One of the Export Options does not exist.");

      exit();

      }

       

      mDocName = d.name.substr (0, d.name.lastIndexOf(‘.’));

      mSourcePath = d.fullName.parent.toString();

      mRootPath =mSourcePath.substr (0, mSourcePath.lastIndexOf(‘/’));

      mTargetPath=mRootPath.concat(‘/final/’);

       

      mTargetPath1=mRootPath.concat('/Final_Deliverables/Publish/');

      mTargetPath2=mRootPath.concat('/Final_Deliverables/Proofs/');

       

       

      mNameHR = mTargetPath1.concat(mDocName,'HR.pdf');

      mName00= mTargetPath2.concat(mDocName,'-00.pdf');

       

      if (!d.saved){

          d.save;

      }   

       

      d.exportFile(ExportFormat.PDF_TYPE, new File(mNameHR), false, preset1);

      d.exportFile(ExportFormat.PDF_TYPE, new File(mName00), false, preset2)

       

       

      alert("Done Exporting Pdf's!");