3 Replies Latest reply on Nov 20, 2013 1:25 AM by Sajeev Sridharan

    Auto-flow of images?

    Davd Spivak - Artstories Level 1

      Is there a script that will autoamtically place the images that I select on my pages without me having to place one image on each page?

        • 1. Re: Auto-flow of images?
          Sajeev Sridharan Level 4

          Try this,

           

          myFiles = myFolder.getFiles("*.*");

          var pageCnt = myFiles.length - 1;

          app.activeDocument.documentPreferences.facingPages = false; 

          var myPage = app.activeDocument.pages.item(0); 

          var myMarginPreferences = myPage.marginPreferences;

          var myPageHeight = app.activeDocument.documentPreferences.pageHeight;

          var myPageWidth = app.activeDocument.documentPreferences.pageWidth;

          var myPages = app.activeDocument.pages;

           

           

          for(i=0; i<pageCnt; i++)

          {

              newPage = app.activeDocument.pages.add();

          }

          for(myCounter = app.activeDocument.pages.length-1; myCounter >= 0; myCounter--)

              myPage = myPages.item(myCounter);

              myRectangle = myPage.rectangles.add(app.activeDocument.layers.item(-1), undefined, undefined, {geometricBounds:[0, 0, myPageHeight, myPageWidth], strokeWeight:0, strokeColor:app.activeDocument.swatches.item("None")});

              myFile = myFiles[myCounter]; 

              myRectangle.place(File(myFile));

          }

           

          Vandy

          • 2. Re: Auto-flow of images?
            Davd Spivak - Artstories Level 1

            Thanks, I'm really new to this, so it's giving me an error that myfolder is undefined. Error Number: 2

            • 3. Re: Auto-flow of images?
              Sajeev Sridharan Level 4

              Try this,

               

              var myFiles = new Array;

              var myFolder = Folder.selectDialog("Select the folder containing the images", "");

              myFiles = myFolder.getFiles("*.*");

              var pageCnt = myFiles.length - 1;

              app.activeDocument.documentPreferences.facingPages = false; 

              var myPage = app.activeDocument.pages.item(0); 

              var myMarginPreferences = myPage.marginPreferences;

              var myPageHeight = app.activeDocument.documentPreferences.pageHeight;

              var myPageWidth = app.activeDocument.documentPreferences.pageWidth;

              var myPages = app.activeDocument.pages;

               

               

              for(i=0; i<pageCnt; i++)

              {

                  newPage = app.activeDocument.pages.add();

              }

              for(myCounter = app.activeDocument.pages.length-1; myCounter >= 0; myCounter--)

                  myPage = myPages.item(myCounter);

                  myRectangle = myPage.rectangles.add(app.activeDocument.layers.item(-1), undefined, undefined, {geometricBounds:[0, 0, myPageHeight, myPageWidth], strokeWeight:0, strokeColor:app.activeDocument.swatches.item("None")});

                  myFile = myFiles[myCounter]; 

                  myRectangle.place(File(myFile));

              }

               

               

              Vandy