29 Replies Latest reply on Jan 18, 2017 4:02 AM by Platini82

    empty lines

    hmn44 Level 1

      Hi again

      does anyone know why emptyt lines are added to my script ?

       

      thanks in advance

        • 1. Re: empty lines
          try67 MVP & Adobe Community Professional

          What do you mean by that, exactly?

          • 2. Re: empty lines
            hmn44 Level 1

            I mean that almost each time I re open my scripts, I can see that some blank lines are added. For information I'm using NotePad++ editor.

            • 3. Re: empty lines
              hmn44 Level 1

              so I use the search (\n\n)  and replace "" to delete these empty lines.

              Is it due to Notepad as editor ?

              • 4. Re: empty lines
                hmn44 Level 1

                sorry not search (\n\n) but \n\r

                • 5. Re: empty lines
                  try67 MVP & Adobe Community Professional

                  I also use Notepad++ and it never added empty lines by itself.

                  You're creating the code using a string, right? Maybe those extra lines are in your original string. You should only use "\n" for a line-break in your string, not "\r\n".

                  • 6. Re: empty lines
                    hmn44 Level 1

                    I 'm using Notepad++ with the encoder ANSI, is it the point ?

                    • 7. Re: empty lines
                      try67 MVP & Adobe Community Professional

                      No, that's fine. Can you post your code?

                      • 8. Re: empty lines
                        hmn44 Level 1

                        I's a bit long I have 3914  (entire script) lines (after deleting the blank lines)

                         

                        when I open a script, close it and re open a new blank line is added ???

                        • 9. Re: empty lines
                          try67 MVP & Adobe Community Professional

                          Then post just a small part of it. I have a feeling it has something to do with the line-breaks in your code, so I want to see how you set it up.

                          • 10. Re: empty lines
                            hmn44 Level 1

                            here is it :

                            //-------------------------------------------------------------

                            //-----------------Ne pas modifier les balises XML--------------------

                            //-------------------------------------------------------------

                             

                            //<Document-Level>

                            //<ACRO_source>CalculStats9KSA</ACRO_source>

                            //<ACRO_script>

                            /*********** appartient à : Document-Level:CalculStats9KSA ***********/

                             

                            function CalculStats9KSA()

                            {

                                var pn="C";                            //C pour Cabin

                                //en scannant toutes compétences de toutes les séquences

                                //reset des compteurs 9KSA

                                var tComp=["PRO","CNS","LTE","GES","COS","COM","DEC"];

                                var tLvl=["NAC","ACC","STD","STP"];

                                for(var c=0; c < tComp.length; c++){            //reset des compteurs pour les 9 compétences

                                    for(var l=0;l<=3;l++){

                                        var Cpt="nAG."+pn+"."+tComp[c]+"."+tLvl[l];

                                        this.getField(Cpt).value = 0;           

                                    }

                                }

                                //Balayage sur la séance

                                 //Scan des séquences pour recherches des 9KSA renseignés

                                for (ns=1;ns <= NbSeqTotal();ns++){

                                    var p=PageSeq(ns).page;var s=PageSeq(ns).seq;

                                    var nn= "P"+p+".NoteSeq."+pn+".Note."+s;

                                    if(this.getField(nn)){                        //si le champ note existe

                                        var noteO=this.getField(nn).value;        //de la forme KSA.LVL.i:KSA.LVL.ijk  pour les 9 compétences

                            • 11. Re: empty lines
                              George_Johnson MVP & Adobe Community Professional

                              Are you talking about an extra line being added at the end of the script each time the editor is used? If so, that's always happened to me, even if I don't actually revise the script text. It is mildly annoying.

                              • 12. Re: empty lines
                                hmn44 Level 1

                                yes, almost, I can see that thesse extra lines are added just below  the comment  /********* appartient à which stand for belongs to (and for each module):

                                 

                                 

                                //<Document-Level>

                                //<ACRO_source>CalculStats9KSA</ACRO_source>

                                //<ACRO_script>

                                /*********** appartient à : Document-Level:CalculStats9KSA ***********/

                                 

                                 

                                 

                                 

                                 

                                 

                                function CalculStats9KSA(PNT){

                                • 13. Re: empty lines
                                  George_Johnson MVP & Adobe Community Professional

                                  It happens for me when you edit individual scripts. It also adds a line at the beginning of individual scripts whenever I select the "Edit All JavaScripts" options, which I rarely use and don't save if I use it to just view the scripts.

                                  • 14. Re: empty lines
                                    try67 MVP & Adobe Community Professional

                                    It seems like you're using the Edit All JavaScripts option. DON'T!

                                    Copy the doc-level script from Document JavaScripts, edit it and then paste it back.

                                    • 15. Re: empty lines
                                      hmn44 Level 1

                                      No I don't use the edit all Javascripts (my scripts are too many) except to delete all the these empty lines.

                                      I use document script  to separate the dedicated functions

                                       

                                      /*********** appartient à : Document-Level:CalculStats9KSA ***********/

                                      • 16. Re: empty lines
                                        try67 MVP & Adobe Community Professional

                                        OK. So are you creating the code using the setAction command that I described to you in another thread?

                                        • 17. Re: empty lines
                                          hmn44 Level 1

                                          • 18. Re: empty lines
                                            hmn44 Level 1

                                            Not only action scripts, I have  many buttons, and dropboxes, many of them  are using actions, these actions are only calling a function; these funtions are using other functions ...

                                            • 19. Re: empty lines
                                              try67 MVP & Adobe Community Professional

                                              That's not what you I mean... In your other thread (Sequence to update the script of one function) I explained to you how to use the addScript command. Are you using it to create these doc-level scripts that you're having a problem with? If so, can you post a sample of the code you're using for that?

                                              • 20. Re: empty lines
                                                hmn44 Level 1

                                                oh sorry, I do apologise

                                                it's another subject , this is why I decided to create a new thread.

                                                I well understood and approved your solution to update the script.

                                                But here I'm only working directly on my file.

                                                 

                                                sorry for the confusion may be due to my english...

                                                • 21. Re: empty lines
                                                  gkaiseril MVP & Adobe Community Professional

                                                  That most likely is a configuration issue with the editor you are using to create and edit the code.

                                                  • 22. Re: empty lines
                                                    hmn44 Level 1

                                                    NotePad++ is very fine for me, I've been looking after that issue for a long time so far but still unsucessful

                                                    • 23. Re: empty lines
                                                      George_Johnson MVP & Adobe Community Professional

                                                      It's doesn't have to do with the editor. It is a bug in Acrobat. An empty line is added by Acrobat when a script is opened in an external editor, even when no changes are made or if changes are made but not saved before closing the external editor. This happens on both Windows and the Mac with all external editors I've ever used.

                                                      • 24. Re: empty lines
                                                        gkaiseril MVP & Adobe Community Professional

                                                        You can add the free macro to remove blank lines from the TextPad site and run that before saving.

                                                        • 25. Re: empty lines
                                                          hmn44 Level 1

                                                          thank you to confirm it's an acrobat issue!

                                                          you 're talking of a free macro removing the blank lines ? I 'm gonna try to find it

                                                          • 26. Re: empty lines
                                                            gkaiseril MVP & Adobe Community Professional

                                                            Yes. It will remove all blank lines from the file. I expect it could be modified  or one could create a new macro to remove only the blank lines after the last line of code.

                                                            • 27. Re: empty lines
                                                              hmn44 Level 1

                                                              ok it's almost what I 'm doing with the search and replace, il's works fine.

                                                              thanks all of you

                                                              Michel

                                                              • 28. Re: empty lines
                                                                vivek1389 Adobe Employee

                                                                Thanks for bringing this issue to Adobe's notice. We have logged a bug for the same and our Engineering team will look into this.

                                                                 

                                                                Regards

                                                                Vivek Chandra

                                                                • 29. Re: empty lines
                                                                  Platini82 Adobe Employee

                                                                  With the latest release of Acrobat on 10th January 2017, this issue has been addressed.

                                                                  To get the latest product update, within the product, click on the menu Help-> Check for updates.

                                                                  For more information about the release, please refer to  Release Notes and the New Feature Summary .