Copy link to clipboard
Copied
Hi again
does anyone know why emptyt lines are added to my script ?
thanks in advance
1 Correct answer
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.
Copy link to clipboard
Copied
What do you mean by that, exactly?
Copy link to clipboard
Copied
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.
Copy link to clipboard
Copied
so I use the search (\n\n) and replace "" to delete these empty lines.
Is it due to Notepad as editor ?
Copy link to clipboard
Copied
sorry not search (\n\n) but \n\r
Copy link to clipboard
Copied
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".
Copy link to clipboard
Copied
I 'm using Notepad++ with the encoder ANSI, is it the point ?
Copy link to clipboard
Copied
No, that's fine. Can you post your code?
Copy link to clipboard
Copied
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 ???
Copy link to clipboard
Copied
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.
Copy link to clipboard
Copied
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
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
Copy link to clipboard
Copied
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.
Copy link to clipboard
Copied
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){
Copy link to clipboard
Copied
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.
Copy link to clipboard
Copied
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.
Copy link to clipboard
Copied
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 ***********/
Copy link to clipboard
Copied
OK. So are you creating the code using the setAction command that I described to you in another thread?
Copy link to clipboard
Copied
Copy link to clipboard
Copied
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 ...
Copy link to clipboard
Copied
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?
Copy link to clipboard
Copied
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...
Copy link to clipboard
Copied
That most likely is a configuration issue with the editor you are using to create and edit the code.
Copy link to clipboard
Copied
NotePad++ is very fine for me, I've been looking after that issue for a long time so far but still unsucessful
Copy link to clipboard
Copied
You can add the free macro to remove blank lines from the TextPad site and run that before saving.
Copy link to clipboard
Copied
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


-
- 1
- 2