Monday, 15 June 2015

How to write inresponse in indesign scripts -



How to write inresponse in indesign scripts -

i running script getting form fields of indd file.

var _all_fields = ""; var allfields = mydocument.formfields; for(var i=0;i<allfields.length;i++){ var tf = allfields[i]; alert(tf.id); alert(tf.label); alert(tf.name); alert(_all_fields = _all_fields +\",\"+ tf.name); }

what have done is, created soap-java based client , calling runscript method. able these fields how send these fields client i.e. how write in response , @ client side how read response.

code calling runscript method is:-

service indesignservice = new servicelocator(); serviceporttype indesignserver = indesignservice.getservice(new url(parsedargs.gethost())); intholder errornumber = new intholder(0); stringholder errorstring = new stringholder(); dataholder results = new dataholder(); indesignserver.runscript(runscriptparams, errornumber, errorstring, results);

also have found in docs runscript method returns runscriptresponse in case it's returning void.

http://wwwimages.adobe.com/content/dam/adobe/en/devnet/indesign/sdk/cs6/server/ids-solutions.pdf

it looks want homecoming array of formfield names. take advantage of everyitem() collection interface method in javascript:

var result = mydocument.formfields.everyitem().name; result;

the javascript homecoming lastly value in called script, create obvious, lastly line value returned.

on java side, runscript method passing results variable 4th parameter, , that's you'll find response. so, after code snippet, might have this:

list<string> formfieldnames = new arraylist<string>(); if (results.value.getdata() != null) { data[] resultsarray = (data[]) results.value.getdata(); (int = 0; < resultsarray.length; i++) { formfieldnames.add(resultsarray[i].getdata().tostring()); } }

indesign adobe-indesign run-script indesign-server

No comments:

Post a Comment