2 Replies Latest reply on Dec 15, 2015 4:08 PM by David André Erichsen

    Error in script Editor

    David André Erichsen Level 1

      Why does this work when running from «ExtendScript Toolkit»...

      PDFexport()
      
      function PDFexport() {
      // app = Application("com.adobe.InDesign");
        myDocument = app.activeDocument;
        myFile = "~/test.pdf";
        myDocument.exportFile(ExportFormat.PDF_TYPE, new File(myFile), false);
      }
      
      
      

       

      ...when this does not from the new Mac OS X Javascript supported «Script Editor»:

       

      PDFexport()
      
      function PDFexport() {
        app = Application("com.adobe.InDesign");
        myDocument = app.activeDocument;
        myFile = "~/test.pdf";
        myDocument.exportFile(ExportFormat.PDF_TYPE, new File(myFile), false);
      }
      
      
      

       

      Error-message: "Error on line 7: ReferenceError: Can't find variable: ExportFormat".

        • 1. Re: Error in script Editor
          Loic.Aigon Adobe Community Professional

          Hi

           

          I don't have a mac at hand but it's likely your issue stands in the particular object model of both environments. While in the extendscript toolkit, you may target InDesign thus loading its own set of properties and methods (...and enumerations such as ExportFormats ), you have probably access to a specific indesign object model with the Mac OS Javascript editor.

           

          However as only the enumeration seems to be an issue, you may try to give the internal value instead of the enum. See here after for details

           

          myDocument.exportFile(1952403524, new File(myFile), false);  
          
          

          Adobe InDesign CS6 (8.0) Object Model JS: ExportFormat

           

          HTH

           

          Loic

          www.ozalto.com

          • 2. Re: Error in script Editor
            David André Erichsen Level 1

            Thank you!

             

            It looks like that could do it, but the File-function now makes an error:

             

            PDFexport()
            
            function PDFexport() {
              app = Application("com.adobe.InDesign");
              myDocument = app.activeDocument;
              myFile = "~/test.pdf";
              // myDocument.exportFile(ExportFormat.PDF_TYPE, new File(myFile), false);
              myDocument.exportFile(1952403524, new File(myFile), false);  
            }
            
            

             

            "Error on line 8: ReferenceError: Can't find variable: File"

             

            Does the File-function have a similar number?