In my current uxp plugin project, I need to perform a specific operatation using ExtendScript. I can do this easily by app.doScript
, but how can I get a return value? The documentation mentions app.scriptArgs
, like in ExtendScript, but that property is obviously non-existant.
In a forum I found something about a script
property in the uxp module, featuring an args
object with similar functionality, but that is not documented and also non-existant, at least in my plugin.
But another post in this forum shows a way that works for me:
const indesign = require('indesign'),
app = indesign.app;
const jsxCode =
"(function (args) { return 'hello ' + args[0]; })(arguments);";
const jsxResult = app.doScript(jsxCode, indesign.ScriptLanguage.JAVASCRIPT, [ 'world' ]);
// jsxResult === 'hello world'