2 Replies Latest reply on Dec 31, 2014 7:52 AM by paulfitz54

    ImageCatalog Script

    paulfitz54

      I came across an excellent script for creating ultimate contact sheets in inDesign called ImageCatalog that has saved me hours and hours of work.

       

      My problem at the moment is I have no control over how the images are imported into inDesign, I would like them to be sorted by filename ie cc1.jpg, cc2.jpg, cc3.jpg, instead they are sorted by cc1.jpg, cc10.jpg, cc11.jpg and so on.

       

      Is there anyway to override this setting in inDesign or would the script have to be modified?

       

      Looking forward to hearing from you

       

      Paul

        • 1. Re: ImageCatalog Script
          Chinnadk Level 4

          Hi Paul,

           

          Try this,

           

          var doc = app.activeDocument,
              _folder = Folder.selectDialog(""),
              _files = _folder.getFiles(),
              filenames = [];
          for(var i =0;i<_files.length;i++)
          {
                  filenames.push(_files[i].name.replace("cc","").replace(".jpg",""))
              }
          filenames.sort(function(a,b){return a-b; });
          var a =0;
          for(var i=0;i<filenames.length;i++)
          {
                  if(a == 0)
                  {
                          doc.pages.item(0).place(File(_folder+ "/cc" + filenames[i]+".jpg"))
                          a = 1;
                      }
                  else
                  {
                          var page = doc.pages.add();
                          page.place(File(_folder+ "/cc" + filenames[i]+".jpg"));
                      }
              }
          

           

          Regards,

          Chinna

          • 2. Re: ImageCatalog Script
            paulfitz54 Level 1

            Hi Chinna,

             

            Thank you for your prompt reply.


            I am not very familiar with Java I know how to run a script but not edit one.

             

            TWo things; do I add the script to the ImageCatalog? And I should have mentioned in my post, the cc in the file name is a code for a category and I have 50 categorie with different codes preceding the numbers, ie ga1 to ga72, hr1 to hr50 and so on.


            I'm  creating a separate inDesign file for each category hopefully sorted by file name, these will be stitched together as a PDF document, Thanks again for your reply


            Paul