8 Replies Latest reply on Nov 8, 2010 3:06 PM by pprocessone

    Scripting to load all pdfs in a month into the place command?

    pprocessone

      Hello, I was wondering if anyone knows of a script that allows for you to place all pdfs within a set date range from a folder into an InDesign document? I am looking to do my monthly report and each month I have to go out and get each one, would be nice to load the place tool with all the pdfs I have done with a set date range and then just place them accordingly. Is there something out there like this and/or am I missing something obvious?

       

      Thanks!

       

      B

        • 1. Re: Scripting to load all pdfs in a month into the place command?
          Marijan Tompa [tomaxxi] Level 4

          Hey!

           

          This is not working code (maybe it is ), but it will give you good start:

           

          function compareDates ( a, b )
          {
            if ( a.created < b.created )
              return 1;
            if ( a.created > b.created )
              return -1;
            return 0;
          }
          
          var myFiles = File.openDialog("Select Files:", "", true);
          myFiles.sort(compareDates);
          
          if(myFiles != null)app.activeDocument.placeGuns.loadPlaceGun(myFiles);
          

           

          Hope that helps.

           

          --

          tomaxxi

          http://indisnip.wordpress.com/

          • 2. Re: Scripting to load all pdfs in a month into the place command?
            pprocessone Level 1

            OK, So like lets say it was from November 1 to November 30 where would that

            go in this a-b ? I am sorry I am not a versed scripter at all.

             

             

            Best regards,

            Robert Borchardt

                                                                                            From:       tomaxxi <forums@adobe.com>                                                                               

            To:         Robert Borchardt <robert.j.borchardt@jci.com>                                                                               

            Date:       11/08/2010 09:39 AM                                                                               

            Subject:    Scripting to load all pdfs in a month into the place command?                                                                               

            Hey!

             

            This is not working code (maybe it is ), but it will give you good start:

             

            function compareDates ( a, b )

            {

              if ( a.created < b.created )

                return 1;

              if ( a.created > b.created )

                return -1;

              return 0;

            }

             

            var myFiles = File.openDialog("Select Files:", "", true);

            myFiles.sort(compareDates);

             

            if(myFiles != null)app.activeDocument.placeGuns.loadPlaceGun(myFiles);

             

             

            Hope that helps.

             

            --

            tomaxxi

            http://indisnip.wordpress.com/

            • 3. Re: Scripting to load all pdfs in a month into the place command?
              pprocessone Level 1

              I'm sorry this didn't work, and I need to mention I need like an example of

              where the date info should be inserted. I apologize I am not a scripter

              guru. BUT I appreciate your assistance!

               

               

              Best regards,

              Robert Borchardt

              414.524.4953

              Johnson Controls, Inc

              507 E  Michigan

              Milwaukee, WI  53202

                                                                                              From:       tomaxxi <forums@adobe.com>                                                                               

              To:         Robert Borchardt <robert.j.borchardt@jci.com>                                                                               

              Date:       11/08/2010 09:39 AM                                                                               

              Subject:    Scripting to load all pdfs in a month into the place command?                                                                               

              Hey!

               

              This is not working code (maybe it is ), but it will give you good start:

               

              function compareDates ( a, b )

              {

                if ( a.created < b.created )

                  return 1;

                if ( a.created > b.created )

                  return -1;

                return 0;

              }

               

              var myFiles = File.openDialog("Select Files:", "", true);

              myFiles.sort(compareDates);

               

              if(myFiles != null)app.activeDocument.placeGuns.loadPlaceGun(myFiles);

               

               

              Hope that helps.

               

              --

              tomaxxi

              http://indisnip.wordpress.com/

              • 4. Re: Scripting to load all pdfs in a month into the place command?
                Marijan Tompa [tomaxxi] Level 4

                Sorry for delay...

                 

                I just tested script and it's working fine for me here.

                I created 4 sample PDF-s with just one page, then started script,

                selected exported PDF-s, script sorts them by creation date and loads placegun.

                So, all you need to do, is to start script and select documents you want to place.

                 

                I changed script little, so make sure you use this one:

                 

                if(app.documents.length != 0){
                    var myFiles = File.openDialog("Select Files:", "*.pdf", true);
                    
                    if(myFiles != null){
                        myFiles.sort(function ( a, b )
                            {
                                if ( a.created < b.created )
                                    return -1;
                                if ( a.created > b.created )
                                    return 1;
                                return 0;
                            }
                        );
                        app.activeDocument.place(myFiles);
                    }else{
                        alert("No files selected!");
                    }
                }else{
                    alert("No documents opened!");
                }
                

                 

                --

                tomaxxi

                http://indisnip.wordpress.com/

                • 5. Re: Scripting to load all pdfs in a month into the place command?
                  pprocessone Level 1

                  IM Sorry tomaxxi, am I suppose to be inputting something somewhere here in

                  regard to the dates? I would need an example like for lets say the month of

                  Nov. I try to paste this and save it in the script editor but it keep

                  saying that the file cannot be saved. Any ideas? Please bear in mind your

                  speaking to a guy who has like zero knowledge when it comes to scripts.

                   

                   

                  Best regards,

                  Robert

                                                                                                  From:       tomaxxi <forums@adobe.com>                                                                               

                  To:         Robert Borchardt <robert.j.borchardt@jci.com>                                                                               

                  Date:       11/08/2010 03:29 PM                                                                               

                  Subject:    Scripting to load all pdfs in a month into the place command?                                                                               

                  Sorry for delay...

                   

                  I just tested script and it's working fine for me here.

                  I created 4 sample PDF-s with just one page, then started script,

                  selected exported PDF-s, script sorts them by creation date and loads

                  placegun.

                  So, all you need to do, is to start script and select documents you want to

                  place.

                   

                  I changed script little, so make sure you use this one:

                   

                  if(app.documents.length != 0){

                      var myFiles = File.openDialog("Select Files:", "*.pdf", true);

                   

                      if(myFiles != null){

                          myFiles.sort(function ( a, b )

                              {

                                  if ( a.created < b.created )

                                      return -1;

                                  if ( a.created > b.created )

                                      return 1;

                                  return 0;

                              }

                          );

                          app.activeDocument.place(myFiles);

                      }else{

                          alert("No files selected!");

                      }

                  }else{

                      alert("No documents opened!");

                  }

                   

                   

                  --

                  tomaxxi

                  http://indisnip.wordpress.com/

                  • 6. Re: Scripting to load all pdfs in a month into the place command?
                    [Jongware] Most Valuable Participant

                    Read http://indesignsecrets.com/how-to-install-scripts-in-indesign.php, it gives you the a-b-c to get started with saving and using scripts.

                     

                    (By the way: can you not include the entire previous mail plus your personal contact info in your reply? It all shows up in the forum ...)

                    • 7. Re: Scripting to load all pdfs in a month into the place command?
                      Marijan Tompa [tomaxxi] Level 4

                      Well, you don't have to input anything to script.

                       

                      Here is little guide how to save and run script:

                      1. Open Adobe ExtendScript Toolkit (You can also use simple text editor)

                      2. Copy script I sent you, and paste it in editor

                      3. Save it to {InDesign Installed Folder}\Scripts\Scripts Panel\placePDF.jsx

                      4. Go to InDesign

                      5. {CS5} Go to menu Window -> Utilities -> Scripts

                      5. {CS4} Go to menu Window -> Automation -> Scripts

                      6. Find script {placePDF.jsx} and run it.

                       

                      Hope that helps.

                       

                      --

                      tomaxxi

                      http://indisnip.wordpress.com/