3 Replies Latest reply on Jun 12, 2013 7:06 AM by doekewartena

    can't find exported png

    doekewartena

      I want to export png's out of a file.

      I would prefer to have them in a output folder located to where the indesign file is saved but it allready goes wrong with this:

       

       

      #includepath "~/Documents/;%USERPROFILE%Documents";
      #include "basiljs/bundle/basil.js";
      
      
      function setup() {
             b.units(b.MM);
        }
      
      
      function draw() {
      
      
          var pages = new Array();
      
      
      for(var j = b.pageCount(); j > 1; j--) {
              var page = b.page(j);
              j.exportFile(ExportFormat.PNG_FORMAT,File("/Users/doekewartena/Documents/temp/test"+j+".png"),false);
                      
                  
          }
      
      
          
      }
      
       b.go();
      

       

      The scrip[t runs without errors but i can't find the file.

        • 1. Re: can't find exported png
          dln385 Level 2

          To put the file in the same folder as the currently executing script, use

           

          new File((new File($.fileName)).parent.fsName + "/test" + j + ".png")
          
          • 2. Re: can't find exported png
            doekewartena Level 1

            I had my for loop wrong as well in previous post.

             

            Now i have:

             

             

            #includepath "~/Documents/;%USERPROFILE%Documents";
            #include "basiljs/bundle/basil.js";
            
            
            function setup() {
                   b.units(b.MM);
              }
            
            
            function draw() {
            
            
                var pages = new Array();
            
            
            for(var i = 0; i < b.pageCount(); i++) {
                    var page = b.page(i);
                   //
            
            
                    //page.exportFile(ExportFormat.PNG_FORMAT,File("/Users/doekewartena/Documents/temp/test"+j+".png"),false);
                    page.exportFile(ExportFormat.PNG_FORMAT, new File((new File($.fileName)).parent.fsName + "/output" + i + ".png"), false);
                            
                        
                }
            
            
                
            }
            
             b.go();
            

             

            But how can i export? i get ReferenceError: page.exportFile is not a function.

            • 3. Re: can't find exported png
              doekewartena Level 1

              someone?