0
Debugging Javascript on InDesign CS3 Server
Community Beginner
,
/t5/indesign-discussions/debugging-javascript-on-indesign-cs3-server/td-p/1379909
Oct 24, 2007
Oct 24, 2007
Copy link to clipboard
Copied
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
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
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting.
Learn more
_Sean_M_Berry_
AUTHOR
Community Beginner
,
/t5/indesign-discussions/debugging-javascript-on-indesign-cs3-server/m-p/1379910#M279131
Oct 24, 2007
Oct 24, 2007
Copy link to clipboard
Copied
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
I can use use "alert('string')" to send it to the STDOUT.
Hope this helps someone else,
_ Sean
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting.
Learn more
Engaged
,
/t5/indesign-discussions/debugging-javascript-on-indesign-cs3-server/m-p/1379911#M279132
Oct 24, 2007
Oct 24, 2007
Copy link to clipboard
Copied
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
Ian
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting.
Learn more
_Sean_M_Berry_
AUTHOR
Community Beginner
,
/t5/indesign-discussions/debugging-javascript-on-indesign-cs3-server/m-p/1379912#M279133
Oct 29, 2007
Oct 29, 2007
Copy link to clipboard
Copied
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...
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...
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting.
Learn more
Engaged
,
/t5/indesign-discussions/debugging-javascript-on-indesign-cs3-server/m-p/1379913#M279134
Oct 29, 2007
Oct 29, 2007
Copy link to clipboard
Copied
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
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
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting.
Learn more
New Here
,
/t5/indesign-discussions/debugging-javascript-on-indesign-cs3-server/m-p/1379914#M279135
Mar 02, 2008
Mar 02, 2008
Copy link to clipboard
Copied
hi Sean M Berry,can you tell how to run javascript via soap server.please waiting for your reply.
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting.
Learn more
New Here
,
/t5/indesign-discussions/debugging-javascript-on-indesign-cs3-server/m-p/1379915#M279136
Mar 06, 2008
Mar 06, 2008
Copy link to clipboard
Copied
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
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
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting.
Learn more
New Here
,
/t5/indesign-discussions/debugging-javascript-on-indesign-cs3-server/m-p/1379916#M279137
Mar 06, 2008
Mar 06, 2008
Copy link to clipboard
Copied
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
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting.
Learn more
New Here
,
LATEST
/t5/indesign-discussions/debugging-javascript-on-indesign-cs3-server/m-p/1379917#M279138
Mar 07, 2008
Mar 07, 2008
Copy link to clipboard
Copied
sunilkumarrajup,
Since XMP is off topic from the original message, I have posted a new message with an answer for you.
Susan
Since XMP is off topic from the original message, I have posted a new message with an answer for you.
Susan
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting.
Learn more

