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

Debugging Javascript on InDesign CS3 Server

Community Beginner ,
Oct 24, 2007 Oct 24, 2007
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);
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
3.4K
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 Beginner ,
Oct 24, 2007 Oct 24, 2007
Found the answer to my own question... finally.

I can use use "alert('string')" to send it to the STDOUT.

Hope this helps someone else,

_ Sean
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
Engaged ,
Oct 24, 2007 Oct 24, 2007
I presume there is some reason you can't just run the javascript in Extendscript connected to server - can't say I've tried that but there is no reason it shouldn't work. The easier way is to use desktop indesign and extendscript - there are a few differences in the abilities with an emphasis on few.

Ian
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 Beginner ,
Oct 29, 2007 Oct 29, 2007
Ian,

Thanks for the response. I discovered a way to get the output I wanted... just using alert() function. It writes to the STDOUT for indesign server so I just capture that in a file and voila.

However, I am interested in using Extendscript for this as well. I am running the Javascript via the SOAP server and need to know how to capture this in Extendscript. So, if I am running on port 10001, how do I still execute via SOAP and capture output in Extendscript?

Thanks...
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
Engaged ,
Oct 29, 2007 Oct 29, 2007
Sorry - I don't know any way to set breakpoints in Extendscript if the javascript comes from anywhere but within Extendscript (now that would be neat Adobe.....). The simpler option is just to capture the script sent across (there are open source network capture tools out there if you can't dump it from the server) and paste it into Extendscript.

Extendscript isn't the best 'ide' in the world, but IMHO being able to view variables, set breakpoints, step through the code, etc is worth a few rough edges'.

Ian
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 ,
Mar 02, 2008 Mar 02, 2008
hi Sean M Berry,can you tell how to run javascript via soap server.please waiting for your reply.
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 ,
Mar 06, 2008 Mar 06, 2008
sunilkumarrajup,

To send a JavaScript script to InDesign Server via SOAP:

1. Startup InDesign Server for use with SOAP by specifying a port:
>indesignserver -port 12345

2. Use the command line application, TestClient, that ships with InDesignServer to send a script to IDS via SOAP:
>testclient -host localhost:12345 c:\myScript.jsx

* for TestClient command line options, simply execute testclient with no options:
>testclient

* for more information, download the IDS SDK from: http://www.adobe.com/devnet/indesign/ and read <SDK>/docs/guides/Intro to InDesign CS3 Server - it contains a section named "Interfacing with InDesign Server through SOAP"

Susan
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 ,
Mar 06, 2008 Mar 06, 2008
hi SusanDoan thanks for helping,ihave done that with your help,thanks so much.i have one more doubt how to create XMP file,hwo to send my information to xmp file,and how to use the xmp in indesign server,can you tell about that xmp.please..thanks for helping..god bless you
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 ,
Mar 07, 2008 Mar 07, 2008
LATEST
sunilkumarrajup,

Since XMP is off topic from the original message, I have posted a new message with an answer for you.

Susan
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