6 Replies Latest reply on Apr 10, 2013 5:15 AM by rajnikids

    Please fix my bit of script for IDML

    rajnikids Level 1

      if (app.activeDocument!=null ) {

      var myDoc = app.activeDocument.save(File(Folder('//Users/Desktop/LW_Qxd_conversion_indd/IndesignFile' )+ "/" + app.activeDocument.name), true);

      var mDoc = app.activeDocument;

      mPath = mDoc.filePath.parent + '/' + "tmp";

      myFilename = app.activeDocument.fullName.toString();

      //~ mPathDoc = app.activeDocument.fullName;

      if (myFilename.match(".indd") !=null){

      myFilename = myFilename.split(".")[0]+"idml";

       

       

      mDoc.exportFile(ExportFormat.INDESIGN_MARKUP, File(Folder('//Users/QXP_8_4_2013/Indesign_CS4')+ "/" + app.activeDocument.name), true);

       

       

      app.activeDocument.close(SaveOptions.no);

      }}

       

      The above script export only one file as IDML after then the script just stops. Can anybody helps on this to export all the open document as IDML.

       

      THANKS. & REGDS.,

        • 1. Re: Please fix my bit of script for IDML
          Vamitul Level 4

          loop thtoug the documents.

          Simplest fix:

          add this first two lines

          for (var qq=0; qq<app.documents.length; qq++){

          app.activeDocument=app.documents[qq];

           

          and

          last line add a }

           

           

          ps. it's a ugly way of fixing your problem, but i'm too lazy to change your code.

          • 2. Re: Please fix my bit of script for IDML
            rajnikids Level 1

            thanks vam!

             

            but what happens is,

             

            it leave atleast 3 document un exported as IDML/unclosed (if the open document count is atleast more than 6).

            it leave atleast 2 document unexported as IDML/unclosed (if the open document count is atleast 5 documents).

             

            any help please...

            thanks & regards,

            • 3. Re: Please fix my bit of script for IDML
              rajnikids Level 1

              thanks vam!,

               

              now i got the point, actually its because of the system speed up..

               

              thanks vam! many apologises for the above post.

               

              thanks & regards,

              rkids

              • 4. Re: Please fix my bit of script for IDML
                rajnikids Level 1

                vam! not an ugly!

                 

                you have added a  great effort to my effort.

                 

                Actualy im including this in my quark to indesign conversion script and directly exporting as idml.

                 

                it really a great help indeed!.. thanks vam.

                • 5. Re: Please fix my bit of script for IDML
                  Vamitul Level 4

                  if it's part of a larger script i suggest doing things properly:

                   

                   

                  for (var i = 0; i < app.documents.length; i++) {
                  
                  
                            var myDoc = app.documents[i];
                            myDoc.save(File(Folder('//Users/Desktop/LW_Qxd_conversio n_indd/IndesignFile') + "/" + myDoc.name), true);
                            mPath = myDoc.filePath.parent + '/' + "tmp";
                            myFilename = myDoc.fullName.toString();
                            if (myFilename.match(".indd") != null) {
                                      myFilename = myFilename.split(".")[0] + "idml";
                                      mDoc.exportFile(ExportFormat.INDESIGN_MARKUP, File(Folder('//Users/QXP_8_4_2013/Indesign_CS4') + "/" + myDoc.name), true);
                                      myDoc.close(SaveOptions.NO);
                            }
                  }
                  
                  
                  • 6. Re: Please fix my bit of script for IDML
                    rajnikids Level 1

                    again & again so much thanks to you vam!!

                     

                    really great and appreciatable.

                     

                    thanks & regards,

                    rkids.