Iterating to all arguments indesign server

1.2k views Asked by At

To recieve arguments in Indesign Server you simply call:

app.scriptArgs.getValue("myvar");

But when I like to iterate over all the arguments, it seems Indesign Server doen't understand how to do this. There is a way with app.scriptArgs.getElements();, but still you can't get any arguments, see documentation.

Does anyone have a idea? I like to recieve an array list of all the arguments passed to the script.

1

There are 1 answers

0
Frank Myat Thu On

After searching via google, I think I found solution.

var Log = new File("~/Desktop/Indd_Report.log" );
Log.open("w");

Log.writeln("app.scriptArgs.getValue(\"ArgumentArray\") = " + app.scriptArgs.getValue("ArgumentArray"));
var _ArugmentArray = app.scriptArgs.getValue("ArgumentArray").split(":");
for(var i=0; i < _ArugmentArray.length; i++ ){
    Log.writeln("_ArugmentArray[i] = " + _ArugmentArray[i]);
}

Log.close();

To Test Run ...

C:\Program Files\Adobe\Adobe InDesign CS5 Server x64>sampleclient -host localhost:18385 "C:\test.jsx" ArgumentArray="One":"Two":"Three"

Finally , Before you invoke SOAP service , you need to add below code

params.scriptArgs.push({name: "ArgumentArray", value:(Value+":"+Value));

For reference link http://forums.adobe.com/thread/853668