Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

empty lines

New Here ,
Apr 06, 2016 Apr 06, 2016

Hi again

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

thanks in advance

TOPICS
Acrobat SDK and JavaScript , Windows
2.3K
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 1 Correct answer

LEGEND , Apr 06, 2016 Apr 06, 2016

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.

Translate
Community Expert ,
Apr 06, 2016 Apr 06, 2016

What do you mean by that, exactly?

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Apr 06, 2016 Apr 06, 2016

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.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Apr 06, 2016 Apr 06, 2016

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

Is it due to Notepad as editor ?

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Apr 06, 2016 Apr 06, 2016

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

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Apr 06, 2016 Apr 06, 2016

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".

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Apr 06, 2016 Apr 06, 2016

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

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Apr 06, 2016 Apr 06, 2016

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

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Apr 06, 2016 Apr 06, 2016

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 ???

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Apr 06, 2016 Apr 06, 2016

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.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Apr 06, 2016 Apr 06, 2016

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+"."+tLvl;

            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

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Apr 06, 2016 Apr 06, 2016

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.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Apr 06, 2016 Apr 06, 2016

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){

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Apr 06, 2016 Apr 06, 2016

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.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Apr 06, 2016 Apr 06, 2016

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.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Apr 06, 2016 Apr 06, 2016

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 ***********/

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Apr 06, 2016 Apr 06, 2016

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

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Apr 06, 2016 Apr 06, 2016

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Apr 06, 2016 Apr 06, 2016

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 ...

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Apr 06, 2016 Apr 06, 2016

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?

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Apr 06, 2016 Apr 06, 2016

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...

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Apr 06, 2016 Apr 06, 2016

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

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Apr 06, 2016 Apr 06, 2016

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

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Apr 06, 2016 Apr 06, 2016

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

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Apr 06, 2016 Apr 06, 2016

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

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines