Debugging Scripts

p. Here’s a simple tip that could make a huge difference in your ability to debug your scripts in Designer:

p. If you use the JavaScript language for a script, you can use the following function to output information to the Acrobat Console:

bc. console.println(“string”);

p. Anyone who has attempted to debug their script(s) in Acrobat knows that it’s a painful thing to do. Unfortunately, many only know about

bc. app.alert(“string”);

or

bc. xfa.host.messageBox(“string”);

p. which gets the job done but not without some headaches and, in certain cases, RSI in your index finger! The other problem is that showing a message box can cause differences in the form’s behaviour especially if you’re trying to debug a script which is setting focus to an object on your form. The fact that a dialog is displayed can really mess things up.

p. By using console.println, you can output text to the Acrobat Console (when in Acrobat — even Preview in Designer — just press Ctrl + J to display it) so that you don’t change the behaviour of your scripts.

p. The ability to debug scripts is something we know needs serious attention in Designer and trust me, we’ve talked about it and we have plans to address these issues but I can’t speak about anything definite at this time.

====
~*Updated:* November 1, 2006~