How can I write the output to the JavaScript console and the clipboard at the same time?
With my JavaScript, I invert the page order and simultaneously write the new page order to the console.
To avoid the hassle of manually copying the sequence of numbers from the console, the new page order should also be immediately added to the clipboard so that it can be inserted into another program using STR+V.
To do this, I create a temporary text field, insert the sequence of numbers, and copy it, hoping to then have it in the clipboard.
Unfortunately, this only works sporadically and is more unreliable than reliable.
I would be grateful for any tips on how I can improve this!
var order = [];
for (var i = this.numPages - 1; i >= 0; i--) {
order.push(i + 1);
}
var orderStr = order.join(" ");
console.println(orderStr);
var f = this.addField("tempCopyField", "text", 0, [0, 0, 300, 20]);
f.value = orderStr;
f.setFocus();
app.execMenuItem("SelectAll");
app.execMenuItem("Copy");
this.removeField("tempCopyField");Regards
yosimo
