9 Replies Latest reply on Jun 10, 2014 5:16 AM by s_ashok

    Help need for Package creation in same path

    siva k Level 1

      Hello everyone,


      I have script for package the file. It’s working good but I need package on the same path instead of on Destktop with file name.

       

      Like if artwork file xyz.idd in D:\ Projects\Today\

      I need same location (D:\ Projects\Today\) with folder name as file name (xyz)

      Can some one modify the code I have tried to modify but it’s not working.

       

      var to = new File("~/Desktop/package_folder/");
      var flag = Folder(to).create();

      var copyingFonts = true;
      var copyingLinkedGraphics = true;
      var copyingProfiles = true;
      var updatingGraphics = true;
      var includingHiddenLayers = true;
      var ignorePreflightErrors = true;
      var creatingReport = true;
      var versionComments = "comment";
      var forceSave = true;

      if ( flag === true){
          app.activeDocument.packageForPrint (
                to,
                copyingFonts,
                copyingLinkedGraphics,
                copyingProfiles,
                updatingGraphics,
                includingHiddenLayers,
                ignorePreflightErrors,
                creatingReport,
                versionComments,
                forceSave
               );
      }

       

      Thanks in Advance

       

      Regards,

      Siva

        • 1. Re: Help need for Package creation in same path
          Mi_D Level 3

          hi

          ADD this line and try

           

          var myDocument = app.activeDocument;
          var myFolder =myDocument.filePath;

          var to = new File(myFolder + "/" + "package_folder/");

           

          Mi_D

          • 2. Re: Help need for Package creation in same path
            siva k Level 1

            Hi


            I have tried your code it’s saying error can please post the whole code here, I am

            Not familiar with code

             

            regards,

            Siva

            • 3. Re: Help need for Package creation in same path
              Mi_D Level 3

              var myDocument = app.activeDocument;

              var myFolder =myDocument.filePath;

              var to = new File(myFolder + "/" + "package_folder/");

              var flag = Folder(to).create();

               

              var copyingFonts = true;

              var copyingLinkedGraphics = true;

              var copyingProfiles = true;

              var updatingGraphics = true;

              var includingHiddenLayers = true;

              var ignorePreflightErrors = true;

              var creatingReport = true;

              var versionComments = "comment";

              var forceSave = true;

               

              if ( flag === true){

                  app.activeDocument.packageForPrint (

                        to,

                        copyingFonts,

                        copyingLinkedGraphics,

                        copyingProfiles,

                        updatingGraphics,

                        includingHiddenLayers,

                        ignorePreflightErrors,

                        creatingReport,

                        versionComments,

                        forceSave

                       );

               

               

              Mi_D

              }

              1 person found this helpful
              • 4. Re: Help need for Package creation in same path
                siva k Level 1

                Hello Mi_D,

                 

                Thanks for your help script are working well. But I am requesting a small change in that. It’s creating every time folder name with “package_folder” instead of InDesign file name. I need package folder name with folder name. This modification will helps for optimization to my daily tasks.

                Ex: My InDesign file name is “Mi_D” the package folder name also “Mi_D” instead of “package_folder

                 

                 

                Thanks in Advance,

                 

                 

                Best regards,

                Siva

                • 5. Re: Help need for Package creation in same path
                  Mi_D Level 3

                  var myDocument = app.activeDocument;
                  var myDocName = myDocument.name;
                  temp=myDocName.replace(/\.indd/g,"");
                  var myFileNme=temp.toString();
                  var myFolder =myDocument.filePath;
                  var to = new File(myFolder + "/" + myFileNme + "/");
                  var flag = Folder(to).create();
                  var copyingFonts = true;
                  var copyingLinkedGraphics = true;
                  var copyingProfiles = true;
                  var updatingGraphics = true;
                  var includingHiddenLayers = true;
                  var ignorePreflightErrors = true;
                  var creatingReport = true;
                  var versionComments = "comment";
                  var forceSave = true;
                  if ( flag === true){
                      app.activeDocument.packageForPrint (
                            to,
                            copyingFonts,
                            copyingLinkedGraphics,
                            copyingProfiles,
                            updatingGraphics,
                            includingHiddenLayers,
                            ignorePreflightErrors,
                            creatingReport,
                            versionComments,
                            forceSave
                           );
                  }

                  Mi_D

                  • 6. Re: Help need for Package creation in same path
                    siva k Level 1

                    Hello Mi_D,

                    Now your script working well exactly what I want many many many thanks for your help.

                     

                     

                    Best regards,

                    Siva

                    • 7. Re: Help need for Package creation in same path
                      s_ashok

                      Hi all,

                      In the same script i need to remove link folder and move all the links to the root folder.

                       

                      Example:

                      Can some one help on these i have tried to modify i can't able to remove the link folder and move the links to the root folder.

                      screen shot.JPG

                       

                       

                      var myDocument = app.activeDocument;

                      var myDocName = myDocument.name;

                      temp=myDocName.replace(/\.indd/g,"");

                      var myFileNme=temp.toString();

                      var myFolder =myDocument.filePath;

                      var to = new File(myFolder + "/" + myFileNme + "/");

                      var flag = Folder(to).create();

                      var copyingFonts = false;

                      var copyingLinkedGraphics = true;

                      var copyingProfiles = true;

                      var updatingGraphics = true;

                      var includingHiddenLayers = true;

                      var ignorePreflightErrors = true;

                      var creatingReport = false;

                      var versionComments = "comment";

                      var forceSave = true;

                      if ( flag === true){

                          app.activeDocument.packageForPrint (

                                to,

                                copyingFonts,

                                copyingLinkedGraphics,

                                copyingProfiles,

                                updatingGraphics,

                                includingHiddenLayers,

                                ignorePreflightErrors,

                                creatingReport,

                                versionComments,

                                forceSave

                               );

                      }

                      • 8. Re: Help need for Package creation in same path
                        Mi_D Level 3

                        Hi,

                         

                        try below code

                         

                        var myDocument = app.activeDocument;

                         

                        var myDocName = myDocument.name;

                         

                        temp=myDocName.replace(/\.indd/g,"");

                         

                        var myFileNme=temp.toString();

                         

                        var myFolder =myDocument.filePath;

                         

                        var to = new File(myFolder + "/" + myFileNme + "/");

                         

                        var flag = Folder(to).create();

                         

                        var copyingFonts = false;

                         

                        var copyingLinkedGraphics = true;

                         

                        var copyingProfiles = true;

                         

                        var updatingGraphics = true;

                         

                        var includingHiddenLayers = true;

                         

                        var ignorePreflightErrors = true;

                         

                        var creatingReport = false;

                         

                        var versionComments = "comment";

                         

                        var forceSave = true;

                         

                        if ( flag === true){

                         

                            app.activeDocument.packageForPrint (

                         

                                  to,

                         

                                  copyingFonts,

                         

                                  copyingLinkedGraphics,

                         

                                  copyingProfiles,

                         

                                  updatingGraphics,

                         

                                  includingHiddenLayers,

                         

                                  ignorePreflightErrors,

                         

                                  creatingReport,

                         

                                  versionComments,

                         

                                  forceSave

                         

                                 );

                         

                        }

                         

                        var moveLink=new Folder(to+"/"+"Links");

                        var myFiles = moveLink.getFiles( "*.*" );

                              for ( i = myFiles.length-1; i >= 0 ; i-- )

                              {

                                  var myResult = myFiles[i].copy(to+"/"+myFiles[i].name);

                                 (myFiles[i]).remove()

                              }

                        moveLink.remove();

                        Mi_D

                        • 9. Re: Help need for Package creation in same path
                          s_ashok Level 1

                          Your script is working fine
                          Thanks Mi_D for your fast help. Thanks a million.

                          Thank you!!!