Copy link to clipboard
Copied
Hi,
I have a JavaSript script that shows a dialog.
While that dialog is still open, I want to copy some string to the clipboard.
I've tried adding a dummy text frame with that string as its content, selecting the content, and invoking app.copy(). But that doesn't work.
I think the reason it doesn't work is that the open dialog prevents adding a new text frame.
Do you have a solution?
Two possibly important details:
If I could access the clipboard directly, that would be fine. The reason behind the above-mentioned method is that it seems there's no direct access to the clipboard.
I need the script to tun on both macOS and Windows.
Thanks!
Copy link to clipboard
Copied
You need a palette-style window for that. And the only way to then do it is what you described: a frame in which you select some text.
w = new Window('palette');
w.copy = w.add ('button', undefined, 'Copy');
w.copy.onClick = function () {
app.copy();
}
w.show();
Copy link to clipboard
Copied
I see. Thank you very much for this reply!