Bug or change in CS5 Extendscript Toolkit debugger or parser
Copy link to clipboard
Copied
I got a strange error beginning to work with a script in CS5 (that is working in CS4, and has a script version setting making it run as CS4).
This is what happened: Pressing Step into code in ExtendScript Toolkit. The window switches to InDesign CS5. Nothing happens. I switch back to the toolkit environment, and there is the blue circle spinning at the bottom right, but nothing else happens.
The status row reads: No Errors
So I press stop, and then the following is written out in the status row (Bottom left of the Extendscript Toolkit CS5):
Cannot execute
Execution halted : Adobe InDesign CS5 did not respond
Trying to debug this error was not easy, since the debugger never entered the code. But at last I found a row containing a comment like this one:
//var sResult = '<![CDATA[' + a + ']]>';
Please will someone else put this code in a new script and see if you get the same effect:
//var sResult = '<![CDATA[' + a + ']]>';
var sResult = 'test';
alert(sResult);
The alert box is not showing up.
You can even minimize the code to this row in a script:
// ']]>';
That single comment in a script makes my debugger hang.
I hope there are no other secret character combinations that need to be removed for my script to run in CS5... Continuing my tests now.Copy link to clipboard
Copied
That's bad ...
You can even minimize the code to this row in a script:
// ']]>';
Is it this exact sequence of characters (do the quotes matter, for example), or can it be shortened?
It's remotely possible the cause is the actual sequence character ]]> because that might get picked up by some XML processing mechanism.
(It's a good thing I don't use the ESTK to write my scripts with. And I don't use CS5 either -- and, come to think of it, what's this "debugging" thing you mentioned?)
Copy link to clipboard
Copied
> because that might get picked up by some XML processing mechanism.
That's my best guess as well. The quotes doesn't matter.
(Debugging... hmmm... I shouldn't talk loud about that here, should I? 😉
Normally I use my Remington typewriter, and send the code to the office for OCR - no bugs, ever - just this CS5 upgrade thing...)
Copy link to clipboard
Copied
Just tried this with ESTK, ScriptBay, and running the script from the script panel, and it hung every time. (CS5, Mac)
As you said, it runs fine in ESTK CS4.
I know that InDesign, at least CS5, returns <![CDATA[]]> in some cases if you try to access a bad property.
for instance, if you have an XML object, myXML, with three elements,
//CS5
myXML.length() //returns 3
myXML.length //returns <![CDATA[]]>
//CS4
myXML.length() //returns 3
myXML.length //returns nothing, passes over the command with error
It's not only XML objects that do this, just happens to be the example I had on hand. I'm also not sure why it hangs on // ']]>';
/dan
Copy link to clipboard
Copied
Great, then it's not just on my computer. The Indesign team ought to take a look at this bug...
Best regards,
Andreas
Copy link to clipboard
Copied
Please report it here: http://www.adobe.com/misc/bugreport.html
If you don't report bugs they don't get fixed.
Peter
Copy link to clipboard
Copied
Yes, I already did that - with a link to this thread.
Thanks,
Andreas
Copy link to clipboard
Copied
A note from the future: this error still occurs in June 2012. If you put a space between the ']'s, however (like so: '] ]'), error no longer occurs and bob's your uncle.
Copy link to clipboard
Copied
@Andreas – I also ran into this bug a couple of months ago. However, I do not see this bug in the latest ESTK for InDesign CS6. Also, if I use the latest ESTK in conjunction with CS5.5 or CS5 I cannot provoke this error.
Seems this bug is fixed…
Here is some code to provoke this bug with ESTK 3.5.1.59 and InDesign CS5.5 v7.5.3:
//A text frame with a table is selected:
_Provoke_C_DATA_Error();
function _Provoke_C_DATA_Error(){
var _d = app.activeDocument;
var _table = app.selection[0].parentStory.tables[0];
var _columns = _table.columns.everyItem().getElements();
for(var c = 0;c<1;c++){
var _cells = _columns[0].cells.everyItem().getElements();
for(var n=_cells.length-1;n>0;n--){
//Provokes C-DATA-Error with InDesign CS5 ESTK or InDesign CS5.5 ESTK
//together with InDesign CS5.5 and InDesign CS6:
$.writeln(_cells
.contents); };
};
}; //Function _Provoke_C_DATA_Error END
Uwe
Copy link to clipboard
Copied
I have to resurrect this old thread.
I wrote "Seems this bug is fixed". As I wrote this more than three years ago I was right according to the shown C-DATA-Error in my snippet.
But I was wrong about the problem Andreas had detected:
// "]]>";
ESTK CC v4.0.0.1 (ExtendScript 4.5.5) is still running an endless loop, if one is using such a statement and runs the script from the ESTK.
There are some workarounds I found:
// 1. Add an empty string before the expression:
$.writeln(""+"]]>");
// 2. Escape one of the three characters:
$.writeln("]]\>");
// 3. Use the Unicode representation:
$.writeln("]]\u003E");
This old problem came up recently here:
ESTK: ']]>' macht Stress 😉
Martin Fischer
http://www.hilfdirselbst.ch/gforum/gforum.cgi?post=545025#545025
Uwe

