I'm working on past Advent of Code puzzles to warm myself up for this year's and I wanted to copy a result to the clipboard so I could paste it into the AOC website.
But I can't see an easy way to do it
Am I missing something simple or is the facility missing?
I came up with this method
and then selecting the value in list block and using ctrl-C on it
wait until(call (JSFunction [data] [let res = null; navigator.clipboard.writeText(data.toString()).then(_ => { res = data; ).catch(err => {throw err;}); return () => res;] :: operators) with inputs [what you need to copy]:: control
Not the same code, but this one would work: (takes a parameter data) const d = typeof data === 'string' ? data : JSON.stringify(data, null, 2); navigator.clipboard.writeText(d); note that running multiple times doesn't guarantee the first one is done before the second runs.
The problem is that navigator.clipboard.writeText is asynchronous, and you need to wait for the returned promise to resolve before doing the next action.
Just click reporter script with [Alt] pressed. For simple types, lists, and multidimensional tables clipboard will be filled with the text representation of the result.