Quantcast
Channel: Adobe Community : Popular Discussions - InDesign Server Developers
Viewing all articles
Browse latest Browse all 20709

Debugging Javascript on InDesign CS3 Server

$
0
0
I, like most developers, need to be able to debug my programs. Thus far I have been opening a file and writing to it if I want to see any debug messages. It looks like this...

my_log = createLogFile("filename",app,true);
add_to_log(my_log, debug_string);
my_log.execute();

This would create a file called "filename.txt", add the value of debug_string to the my_log object, then write the log to a file using execute.

However, this approach is not very helpful when doing loops for example. If I have a loop that is breaking my script and I want to check a value that is changing inside a loop I have to create a file, add the error to the log, and execute (write) the log for each pass in the loop. For instance:

for (var i = 0; i < some_array.length; i++) {
my_log = createLogFile("debug_log"+i, app, true);
add_to_log(my_log, some_array[i]);
my_log.execute();
...
whatever is normally in here
...
}

This is the only way I can figure out which item in my array is breaking the script. So, my ultimate question is this:

How do I debug an InDesign server javascript program? Can I write to STDOUT, or STDERR? Some other way? Thanks for any and all help.

_ Sean

Viewing all articles
Browse latest Browse all 20709

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>