Given the slight complexity of quoting and escaping code text, which you draw attention to at:
https://omni-automation.com/shared/url-app-to-app.html
in the notice which reads:
IMPORTANT: note the inclusion of both the trailing semi-colon AND backslash character () together at the end of each of the lines of calling script code. As the script code text is combined to a single-line, these characters ensure that the script code is read correctly as it is converted from text to code during the script execution.
I wonder whether you think that users might find it easier to skip quoting and escaping, and make use of the fact that the .toString() method works on JavaScript functions ?
e.g. perhaps some variant on the theme of:
function ooPart() {
return rootItem.children
.map(function (x) {
return x.topic;
});
}
var scriptURL = URL.tellScript('OmniOutliner', ooPart.toString() + '()');
(Where the final ‘()’ creates the function invocation - though I guess one could perhaps adjust the implementation of tellScript to append that itself, and simply expect a function string ?)